Message: 14
Date: Sat, 6 Aug 2005 18:53:26 -0700
From: TJ Frame <[EMAIL PROTECTED]>
Subject: a few geometry questions...
To: How to use Revolution <use-revolution@lists.runrev.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

Hi everyone,
 1) If I have the points A and B, how would I determine point C that lies
along the slope but is X units in length from the origin (which will always
be point A)
 I can find the total distance between A and B or the midpoint using the
distance and midpoint formulas, but I'm not sure how to plug in a specific
distance value.
 2) I also need to be able to find out where a circle of a given radius
whose orgin is at A intersects that imaginary line. Given that A will always
be the origin of the circle and I only want the single intersection heading
towards point B I wouldn't need to check for all possible solutions such as
non-intersection etc.
 Any help would be greatly appreciated.. I'm an artist by trade and haven't
messed with geometry and algebra since high school!
 - TJ

TJ,

This may be more than you want to know. The intersection point between a line and a circle is a lengthy calculation. (Actually there a two points of intersection. See the function on how to get them both.)

I have copied the function below. You can check out the functionality in the following stack. Run the following in the msg box.

go stack url "http://home.infostations.net/jhurley/LineCircleIntersection.rev";

The intersection function is:

function theIntersectionPt tCircleName, aPt,bPt
  --This function determines the point of intersection
  --between the circle names tCircle name
  --and the two points aPt and bPt

  put the width of grc tCircleName /2 into a
  put theLineAngle(aPt,bPt) into ABangle
  --put 180/pi*ABangle into tempV
  put the loc of grc tCircleName into cPt
  put theLineAngle(aPt,cPt) into ACangle
  --put 180/pi*ACangle into tempC
  put ABangle - ACangle into alpha
  if alpha is 0 then add .0001 to alpha
  put theDist(aPt,cPt) into b

  --law of sines
  put  b*sin(alpha)/a into sinBeta
  if abs(sinBeta) > 1 then
    choose the browse tool
    return ""
  else
    put asin(sinBeta) into beta
  end if

  --There are two points of intersection
  --with the impact circle. Gamma defines one and
  --the other is at pi - gamma.
  --The one closest to point A is:
  put pi - beta into beta--Omit this step if you want the more distant point
  --Or get both and return both. Use the two points as needed.
  put 180/pi*beta into tempBeta
  put pi - alpha - beta into gamma
  if gamma > pi/2 then put pi-alpha-beta into gamma
  put 180/pi*gamma into tempGamma

  --Law of sines again
  put a*sin(gamma)/sin(alpha) into c
  put c*cos(ABangle)into dABx--vx/v into dBx
  put c*sin(ABangle) into dABy--vy/v into dBy
  --Get end points of line from aPt to intersection point
  put item 1 of aPt into x
  put item 2 of aPt into y
  put x+dABx,y+dABy into tInterectionPt
  return tInterectionPt
end theIntersectionPt


Jim

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to