Jump to content

Formula to get a point on a 3 points arc


MSasu

Recommended Posts

I have to admit, the analytic geometry wasn’t my preferred field of study and this pay back sometime.

I’m trying to find the formula to locate a point on an arc given by 3 points. In the sketch below I know the X and Y coordinates of points P1, P2 and P3, respectively the X coordinate of point P4 – I’m looking for the formula to find the Y coordinate of point P4 using the arc equation (all points are laying on the arc).

 

arc_sketch.gif

 

I will appreciate if someone can help me on this mater. Thank you.

 

Regards,

Mircea

Link to comment
Share on other sites

I think you are going to need to enlighten us a bit more

 

Given the 3 points, we can find the center, radius, start angle, end angle, included angle, chord data and a lot of other stuff.

 

You will need to set some parameters for P4. Is is half way form P2 to P3 ? What is the basis for P4? -David

Link to comment
Share on other sites

Based on the above sketch:

input
    X1, Y1
    X2, Y2
    X3, Y3
    X4 (where X1 < X4 < X3)
output
    Y4

Hope that this is a better explanation. Thank you.

 

Regards,

Mircea

Link to comment
Share on other sites

For a mathematical approach I'd try treating the arc as a circle. With the center point, radius, and an x value you can use the equation for a circle to solve for two y values. You could use vlax-curve-getClosestPointTo to determine which of the points is on the arc.

 

From the general equation for a circle (x - h)^2 + (y - k)^2 = r^2, where h is the x value for the center, k is the y value of the center, r is the radius, and x is the x value of the point you are looking for,

 

y = k + (r^2 - (x - h)^2)^2

y = k - (r^2 - (x - h)^2)^2

 

For a mechanical approach create a line from (x4 , -10) to (x4 , 10), then use use 'IntersectWith to find the actual point, then erase the temporary line. You would need to set the variable in the IntersectWith function to extend only the line. An example for the IntersectWith function is VXGetInters from http://www.menziengineering.ch/Downloads/Download.htm#17

Link to comment
Share on other sites

What happens when the arc goes thru 180 degrees? There can be 2 solutions to the problem. -David

Yes, you are right, if the arc is bigger than 180 degrees may get two intersections - however this can't happen with my data. The Y coordinate of center will always be located below Y1, Y2 and Y3.

 

Regards,

Mircea

Link to comment
Share on other sites

Is there a relationship between the coordinates?

Could you post some of them?

Are they results of other calculations?

 

regards,

SB

Link to comment
Share on other sites

This will return the two y-values for the two points on the circle defined by p1, p2 & p3 for the specified value of x4:

 

(defun test ( p1 p2 p3 x4 / _mid m1 m2 c1 r1 y4 )
 
 (defun _mid ( a b ) (mapcar '/ (mapcar '+ a b) '(2. 2.)))

 (setq m1 (_mid p1 p2)
       m2 (_mid p2 p3)
 )
 (setq c1
   (inters
     m1 (polar m1 (+ (angle p1 p2) (/ pi 2.)) 1.)
     m2 (polar m2 (+ (angle p2 p3) (/ pi 2.)) 1.) nil
   )
 )
 (setq r1 (distance c1 p1)
       x4 (- x4 (car c1))
       y4 (sqrt (- (* r1 r1) (* x4 x4)))
 )
 (mapcar '+ (list y4 (- y4)) (list (cadr c1) (cadr c1)))
)

Link to comment
Share on other sites

Thank you for your answers. I have now to check those equations. I'm affraid that I forgot to mention that I will use the formula in a stand-alone application (Visual Basic or C#), so cannot take advantage of AutoCAD/AutoLISP features.

 

Regards,

Mircea

Link to comment
Share on other sites

Thank you for your answers. I have now to check those equations. I'm affraid that I forgot to mention that I will use the formula in a stand-alone application (Visual Basic or C#), so cannot take advantage of AutoCAD/AutoLISP features.

 

Regards,

Mircea

 

Yet, you posted this in the "AutoLISP, Visual LISP & DCL" section. :?

Link to comment
Share on other sites

Yet, you posted this in the "AutoLISP, Visual LISP & DCL" section. :?

My thought was that among programmers will find someone with knowledge of analytic geometry.

I'm not sure if there is a better section for this thread - if so, I will apreciate if you will fix my mistake and move it. Sorry if any inconvenience. Thank you.

 

Regards,

Mircea

Link to comment
Share on other sites

I am trying to figure out the best location for this right now, I think I will put it in the AutoCAD General section and see if we can get you some answers. No inconvenience at all, just you had everyone looking at your problem from a LISP type perspective.

Link to comment
Share on other sites

@SEANT: just played a little with your calculator and is simply amaizing! THis is exact what I was looking for. Thank you very much for your help!

 

Regards,

Mircea

Link to comment
Share on other sites

 

I’m happy that it helped.

The spreadsheet does not have all the necessary error

checking (it will fail if any pair of the three points are stacked perfectly

vertical) but that should be easy enough to do when transferred to code.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...