Hi!
This is probably a trigonometry problem (in the first place)
Assume 3 points in the arc of a circle are known. (the values are a bit simplified)
(on the top of the circle)p1 = [10, 50] // the start valuep2 = [45, 51.5] // the middle valuep3 = [100.50] // the end value
is this sufficient to calculate the other values between these points (the y-value) in the arc of the circle?
(or do I also need to know the radius and center point of the circle before the arc of the circle can be calculated?)
I am looking for a function() that generates these values?
(may also need to be supplemented which direction the values should be generated - but that is a later "problem" :-))
p1 = [10, 50] // the start valuep2 = [45, 51.5] // the middle valuep3 = [100.50] // the end value
points = function(p1,p2,p3);
polygon(points);- . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . -
This function() is used when I know the center and radius of the circle
fn = 100;
points1 = circSect( 10, 11.25, 10, [0, 90], "bottom", 1, fn);polygon(points1);
function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24) = let( startAngel = (startRef == "left") ? 0 : (startRef == "bottom") ? 90 : (startRef == "right") ? 180 : (startRef == "top") ? 270 : undef, r = radius / cos(180 / fn), step = 360 / fn, // points = [[x, y], points = [ for(a = [angles[0]-startAngel : step : angles[1]-startAngel]) [-rotate * r * cos(a)+x, r * sin(a)+y]] ) points;
You may want to re-check your list of points: the midpoint between 10
and 100 is 55, not 45.
But yes, to answer your question, knowing the endpoints of a chord of a
circle, and the coordinates of the point on the circle corresponding to
the center of the chord, it's trivial to determine the radius and the
center of the circle. This in turn gives the equation of the circle,
which will give you all points you need. No trigonometry is needed, just
geometry and algebra.
This is easiest if the chord is on the x-axis and centered at the
y-axis. Endpoints are thus (-x, 0) and (+x, 0), and the middle value is
(0, y1). The center is thus at (0, y2). All three points are at distance
r from the center. The center, the origin, and either of the endpoints
-- choose the one in positive x for convenience -- form a right
triangle. One leg of the triangle is length x, the other leg is length
y2, and the hypotenuse is length r. Note that y2 = r - y1. By the
Pythagorean theorem, r^2 = x^2 + (r - y1)^2
r^2 = x^2 + r^2 - 2ry1 + y1^2
...
r = (x^2 + y1^2) / (2 * y1)
So the two points (0, y1) and (x, 0) yield a circle with radius r = (x^2
In your specific case (assuming the middle point is actually (55, 51.5)
not (45, 51.5 as stated), you need to shift left 55 and down 10 to
position the chord as I described above -- so do the calculations, then
shift the calculated center right 55 and up 10.
I get r = 55.119 and center = (55, 6.381).
On 3/31/2022 3:01 AM, Jan Öhman wrote:
Hi!
This is probably a trigonometry problem (in the first place)
Assume 3 points in the arc of a circle are known. (the values are a
bit simplified)
(on the top of the circle)
p1 = [10, 50] // the start value
p2 = [45, 51.5] // the middle value
p3 = [100.50] // the end value
is this sufficient to calculate the other values between these points
(the y-value) in the arc of the circle?
(or do I also need to know the radius and center point of the circle
before the arc of the circle can be calculated?)
I am looking for a function() that generates these values?
(may also need to be supplemented which direction the values should be
generated - but that is a later "problem" :-))
p1 = [10, 50] // the start value
p2 = [45, 51.5] // the middle value
p3 = [100.50] // the end value
points = function(p1,p2,p3);
polygon(points);
This function() is used when I know the center and radius of the circle
fn = 100;
points1 = circSect( 10, 11.25, 10, [0, 90], "bottom", 1, fn);
polygon(points1);
function circSect(x=0, y=0, radius=10, angles=[0,270],
startRef="bottom", rotate=1, fn=24) =
let(
startAngel = (startRef == "left") ? 0
: (startRef == "bottom") ? 90
: (startRef == "right") ? 180
: (startRef == "top") ? 270
: undef,
r = radius / cos(180 / fn),
step = 360 / fn,
// points = [[x, y],
points = [
for(a = [angles[0]-startAngel : step : angles[1]-startAngel])
[-rotate * r * cos(a)+x, r * sin(a)+y]]
) points;
Thank you!
(for reference) Cirkel - Geometri - Plan figurer - Matematik minimum - Terminologi och begreppsförklaring
|
|
|
| | |
|
|
|
| |
Cirkel - Geometri - Plan figurer - Matematik minimum - Terminologi och b...
|
|
|
radius = ((s^2) + (4 * h^2)) / (8 * h)
(for reference)
Rasmus.is - Trigonometri (sin, cos och tan))
| | |
Rasmus.is - Trigonometri (sin, cos och ...
|
degrees = sin(a / radius)
So far "no problem"
p1 = [10, 50]; // the start valuep2 = [55, 51.5]; // the middle valuep3 = [100.50]; // the end value
// http://matmin.kevius.com/cirkel.php// r = ((s^2) + (4h^2)) / (8h)
s = 100 - 10; // 90 (from above)h = 51.5 - 50; // 1.5 (from above)radius = ((s^2) + (4h^2)) / (8h); // 675.75echo(s^2, 4h^2, 8h, radius);
a = (100 - 10)/2; // http://www.rasmus.is/sv/t/G/su30k3.html
// deg = degrade( sin( a / radius ));deg = asin( a / radius );echo( a, radius, deg );
But, how to convert to degrees from arc sin() - radiansAm I thinking wrong?
Den torsdag 31 mars 2022 15:32:02 CEST, Douglas Miller <doug@milmac.com> skrev:
You may want to re-check your list of points: the midpoint between 10 and 100 is 55, not 45.
But yes, to answer your question, knowing the endpoints of a chord of a circle, and the coordinates of the point on the circle corresponding to the center of the chord, it's trivial to determine the radius and the center of the circle. This in turn gives the equation of the circle, which will give you all points you need. No trigonometry is needed, just geometry and algebra.
This is easiest if the chord is on the x-axis and centered at the y-axis. Endpoints are thus (-x, 0) and (+x, 0), and the middle value is (0, y1). The center is thus at (0, y2). All three points are at distance r from the center. The center, the origin, and either of the endpoints -- choose the one in positive x for convenience -- form a right triangle. One leg of the triangle is length x, the other leg is length y2, and the hypotenuse is length r. Note that y2 = r - y1. By the Pythagorean theorem, r^2 = x^2 + (r - y1)^2
r^2 = x^2 + r^2 - 2ry1 + y1^2
...
r = (x^2 + y1^2) / (2 * y1)
So the two points (0, y1) and (x, 0) yield a circle with radius r = (x^2 + y1^2) / (2 * y1), and center at (0, y1 - r).
In your specific case (assuming the middle point is actually (55, 51.5) not (45, 51.5 as stated), you need to shift left 55 and down 10 to position the chord as I described above -- so do the calculations, then shift the calculated center right 55 and up 10.
I get r = 55.119 and center = (55, 6.381).
On 3/31/2022 3:01 AM, Jan Öhman wrote:
Hi!
This is probably a trigonometry problem (in the first place)
Assume 3 points in the arc of a circle are known. (the values are a bit simplified)
(on the top of the circle) p1 = [10, 50] // the start value p2 = [45, 51.5] // the middle value p3 = [100.50] // the end value
is this sufficient to calculate the other values between these points (the y-value) in the arc of the circle?
(or do I also need to know the radius and center point of the circle before the arc of the circle can be calculated?)
I am looking for a function() that generates these values?
(may also need to be supplemented which direction the values should be generated - but that is a later "problem" :-))
p1 = [10, 50] // the start value p2 = [45, 51.5] // the middle value p3 = [100.50] // the end value
points = function(p1,p2,p3);
polygon(points); - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . - . _ . -
This function() is used when I know the center and radius of the circle
fn = 100;
points1 = circSect( 10, 11.25, 10, [0, 90], "bottom", 1, fn); polygon(points1);
function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24) = let( startAngel = (startRef == "left") ? 0 : (startRef == "bottom") ? 90 : (startRef == "right") ? 180 : (startRef == "top") ? 270 : undef, r = radius / cos(180 / fn), step = 360 / fn, // points = [[x, y], points = [ for(a = [angles[0]-startAngel : step : angles[1]-startAngel]) [-rotate * r * cos(a)+x, r * sin(a)+y]] ) points;
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org