This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Hi,

I'm working on a cad type thing and i need to draw an arc in 2d from three points - i believe there is only one solution.

I really need a little code to help me out here, or at least fully solved eqs in terms of the 3 points, and anything in addition would be great (ie radius/sweep + centre etc)

I'm drawing in openGL / GDI - is there an easier way? not sure how to use gdi or gl to draw an arc from 3 points

thanks

faraz

I'm working on a cad type thing and i need to draw an arc in 2d from three points - i believe there is only one solution.

I really need a little code to help me out here, or at least fully solved eqs in terms of the 3 points, and anything in addition would be great (ie radius/sweep + centre etc)

I'm drawing in openGL / GDI - is there an easier way? not sure how to use gdi or gl to draw an arc from 3 points

thanks

faraz

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

point 0 is the starting point

point 1 control point

point 2 control point

point 4 endpoint

You can use it to draw a complete system of points and it will use points 0-4 for the first line then points 1,2,3 for the next then 2,3,4 -- 3,4,5 for the whole line ...

BOOL PolyBezier(

HDC hdc, // handle to device context

CONST POINT *lppt, // pointer to endpoints and control points

DWORD cPoints // count of endpoints and control points

);

J.

someting that can be considered is using paths here. Calculate the radius of the cirlce or shape that the arc WOULD be part of and then parametrize that shape. Simply bound that parametrized shape by the two endpoints and you have a complete path function in terms of t ( ex: F(t) ) that will give you a point for every t that is plugged in. Much better than using interection, much more efficient.

Note: you might need to parametrize the path using two variables instead of just one depending on regularity of the shape. Also, you can create a vector Field from those two points and simply make a funciton known as the flowline which is the same as the path in R-space.

many vector calculus sites out there. Good luck

How do you propose calculating the radius of the arc without knowing the centerpoint? I don't see how Calculus is going to get you there any easier or more efficiently.

Kdo

Given points (a,b), (c,d), and (e,f) the center (h,k) of the circle can be found at:

h = ((a*b+b*b)*(f-d) + (c*c+d*d)*(b-f) + (e*e+f*f)*(d-b)) / (2*(a*(f-d)+c*(b-f)+e*(d-b

k = ((a*a+b*b)*(e-c) + (c*c+d*d)*(a-e) + (e*e+f*f)*(c-a)) / (2*(b*(e-c)+d*(a-e)+f*(c-a

r = sqrt((a-h)*(a-h) + (b-k)*(b-k));

(Solutions taken from http://mcraefamily.com/MathHelp/GeometryConicSectionCircleEquationGivenThreePoints.htm )

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trialwas planning to implement this sometime last week, but found mayself recooking the architecture instead! h=, k=,r= gives me pretty much what i need to make this work - (unfortunately my vector calculus is a little lacking)

faraz

C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

Well, I'm not sure of an API that will plot an arc given 3 points, but you could always write one. :)

The math involved is pretty simple, mostly geometry, a little alegbra, maybe some trig.

Given the arc ABC, draw two length segments AB and BC.

Draw the perpendicular bisector at AB and BC. Where they intersect is the center of the circle (arc), D.

Now you can draw the arc from AC with centerpoint D.

The centerpoint of AB is the point ((Ax+Bx)/2,(Ay+By)/2)

The centerpoint of BC is the point ((Bx+Cx)/2,(By+Cy)/2)

Compute the line through each of those points and calculate the intersection.

Kdo