Please see the image below for a visual clue to my problem:
I have the coordinates for points 1 and 2. They were derived by a formula that uses the other information available (see question: How to calculate a point on a circle knowing the radius and center point).
What I need to do now (separately from the track construction) is plot the points in green between point 1 and 2.
What is the best way of doing so? My Maths skills are not the best I have to admit and I'm sure there's a really simple formula I just can't work out (from my research) which to use or how to implement.
The circumference is the distance around a circle. In other words, it's the perimeter of the circle. And we find the circumference by using the formula C = 2πr.
We can use the measure of the arc (in degrees) to find its length (in linear units). where d is the diameter of the circle and r is the radius of the circle. In a circle, the ratio of the length of a given arc to the circumference is equal to the ratio of the measure of the arc to 360°.
So, we know the angle α of the arc between the two points -- it's just α = s / r = 2 π / x. Then, using the formula from the first answer, we have: Law of cosines: a 2 = 2 R 2 ( 1 − 2 c o s ( α)), where α is the angle measure of an arc, and a is the distance between points. α = 2 π ( a r c c i r c u m f e r e n c e).
where d is the diameter of the circle and r is the radius of the circle. In a circle, the ratio of the length of a given arc to the circumference is equal to the ratio of the measure of the arc to 360°. The length of a semicircle is one half the circumference, and the length of a 90° arc is one quarter of the circumference.
The distance between two points on a circle (chord length) can be computed with the formula for the length of a chord: d = 2•r•sin (a/2r) where: d is the length of the chord. r is the radius of the circle. a is the arc length.
In the notation of my answer to your linked question (i.e. x,y is the current location, fx,fy is the current 'forward vector', and lx,ly is the current 'left vector')
for (i=0; i<=10; i++)
{
sub_angle=(i/10)*deg2rad(22.5);
xi=x+285.206*(sin(sub_angle)*fx + (1-cos(sub_angle))*(-lx))
yi=y+285.206*(sin(sub_angle)*fy + (1-cos(sub_angle))*(-ly))
// now plot green point at (xi, yi)
}
would generate eleven green points equally spaced along the arc.
The equation of a circle with center (h,k) and radius r is
(x - h)² + (y - k)² = r² if that helps
check out this link for points http://www.analyzemath.com/Calculators/CircleInterCalc.html
The parametric equation for a circle is
x = cx + r * cos(a) y = cy + r * sin(a) Where r is the radius, cx,cy the origin, and a the angle from 0..2PI radians or 0..360 degrees.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With