Author Topic: get tangential point of arc's  (Read 1727 times)

0 Members and 1 Guest are viewing this topic.

CADwiesel

  • Newt
  • Posts: 46
  • Wir machen das Mögliche unmöglich
get tangential point of arc's
« on: March 05, 2018, 08:55:32 AM »
Dear Guys,
Now i try to develop an function for joining two arcs at there tangential point. First of all, how to find this point on an fast way. Based on the true, the small arc below (Arc2) the longe one on top (Arc2) is the one which is to be aligned to the other, by rotating at the point P1.
The way to 'cut' the Arc2 into several segments or calcolate a lot of points along this and than verify each one of this by using the vlax-curve-getClosestPointTo methode seems to be to slow. Also if you'll find the closest Point, its not the tangential point when i want to join this both curves tangential.
Maybee its more easy to find this point while constructing the 2. arc. If there are some ideas, may this wouls also help.
For better understanding. Both arcs have an defined startpoint and an fixed (known) radius. Only the second Point of the Arc2 is unknown.
Afterall i want an figur like second image.
May there are some suggestions, please?
« Last Edit: March 05, 2018, 10:25:00 AM by CADwiesel »
Gruß
CADwiesel
Besucht uns im CHAT

hmspe

  • Bull Frog
  • Posts: 367
Re: get tangential point of arc's
« Reply #1 on: March 05, 2018, 10:54:56 AM »
"Science is the belief in the ignorance of experts." - Richard Feynman

ribarm

  • Gator
  • Posts: 3313
  • Marko Ribar, architect
Re: get tangential point of arc's
« Reply #2 on: March 05, 2018, 11:20:03 AM »
Hi...

When rotating around P1 it is very possible that when arc2 reaches arc1 at single point of intersection, tangents from arc1 and arc2 at that point won't match... Maybe you should consider move+rotate, so that that unknown end point of arc1 be coincident with start point of arc1 and rotation afterwards of arc2 around that start point - unknown point of arc2 after moving is performed, is processed all until tangents match... That could be achieved by looking at angles of tangent vectors (vlax-curve-getfirstderiv arc (vlax-curve-getstart/endparam arc)), finding difference angle and then rotating for that amount...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: get tangential point of arc's
« Reply #3 on: March 05, 2018, 12:58:54 PM »
If C1 is the center of Arc1, R1 it's radius, R2 the radius of Arc2, then draw a circle in C1 and radius R1-R2 (or offset Arc1 with R2).
Then draw a circle in P1 and radius R2. The 2 circle intersection is the center of the arc 2 you are looking for. You might have 1, 2 or no solutions.


ribarm

  • Gator
  • Posts: 3313
  • Marko Ribar, architect
Re: get tangential point of arc's
« Reply #4 on: March 05, 2018, 01:38:23 PM »
Yes, Stefan. Nice picture.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

CADwiesel

  • Newt
  • Posts: 46
  • Wir machen das Mögliche unmöglich
Re: get tangential point of arc's
« Reply #5 on: March 06, 2018, 02:26:16 AM »
Many thanks to all. Reasently i coldn't use an geometrical solution, so i will study the link posted by hmspe. This in connection with an rotate command may be the target.
Gruß
CADwiesel
Besucht uns im CHAT

ribarm

  • Gator
  • Posts: 3313
  • Marko Ribar, architect
Re: get tangential point of arc's
« Reply #6 on: March 07, 2018, 01:30:27 AM »
Maybe something like this could be more adequate :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:move+matchtangents ( / c1 p1 par1 c2 p2 par2 a1 a2 )
  2.  
  3.  
  4.   (while (or (not (setq c1 (car (entsel "\nPick curve 1 for moving and roatating till match tangents...")))) (if c1 (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartpoint (list c1)))))
  5.     (prompt "\nMissed or picked entity that isn't curve entity...")
  6.   )
  7.   (while (or (or (initget 1) (not (setq p1 (getpoint "\nPick or specify point on curve 1 : ")))) (if p1 (not (setq par1 (vlax-curve-getparamatpoint c1 p1)))))
  8.     (prompt "\nPicked or specified point don't belong to curve 1...")
  9.   )
  10.   (while (or (not (setq c2 (car (entsel "\nPick curve 2 - matching curve...")))) (if c2 (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartpoint (list c2)))))
  11.     (prompt "\nMissed or picked entity that isn't curve entity...")
  12.   )
  13.   (while (or (or (initget 1) (not (setq p2 (getpoint "\nPick or specify point on curve 2 : ")))) (if p2 (not (setq par2 (vlax-curve-getparamatpoint c2 p2)))))
  14.     (prompt "\nPicked or specified point don't belong to curve 2...")
  15.   )
  16.   (vla-move (vlax-ename->vla-object c1) (vlax-3d-point p1) (vlax-3d-point p2))
  17.   (setq a1 (angle '(0.0 0.0) (vlax-curve-getfirstderiv c1 par1)))
  18.   (setq a2 (angle '(0.0 0.0) (vlax-curve-getfirstderiv c2 par2)))
  19.   (vla-rotate (vlax-ename->vla-object c1) (vlax-3d-point p2) (- a2 a1))
  20.   (while (= (progn (initget 1 "Yes No") (getkword "\nIs matching of tangents correct (Yes), or it is better to rotate curve 1 for 180 degree (No) [Yes/No] : ")) "No")
  21.     (vla-rotate (vlax-ename->vla-object c1) (vlax-3d-point p2) pi)
  22.   )
  23.   (princ)
  24. )
  25.  

HTH., M.R.
« Last Edit: March 07, 2018, 02:44:19 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube