a few geometry questions...
TJ Frame
tjframe at gmail.com
Sun Aug 7 00:14:31 EDT 2005
James,
Thanks for your help. The code did not work for me "as is". Namely point C
was reflected negatively, so I fixed that by using -X, then I had to
subtract Cx and Cy from A's location in order to offset C correctly. But
after that it worked perfectly! Thanks again for your quick response.
-----------------------------------------------------------------------------------------
function findSegmentPoint pointA, pointB, tLength
put -tLength/findLength (pointA,pointB) into tRatio
put tRatio * (item 1 of pointB - item 1 of pointA) into Cx
put tRatio * (item 2 of pointB - item 2 of pointA) into Cy
return round(item 1 of pointA - Cx) & comma & round(item 2 of pointA - Cy)
end findSegmentPoint
function findLength p1,p2
return round(sqrt((item 1 of p2 - item 1 of p1) ^ 2 + (item 2 of p2 - item 2
of p1) ^ 2))
end findLength
--------------------------------------------------------------------
- TJ
On 8/6/05, James Spencer <jspencer78 at mac.com> wrote:
>
>
> On Aug 6, 2005, at 8:53 PM, TJ Frame wrote:
>
> > 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.
>
> It's late and I'm fuzzy so I'm sure this can be optimized
> particularly as I'm not sure how good Rev is at geometric functions
> but without using them, given distance A to C is X assuming you have
> calculated that the distance from A to B is Y and (continuing to use
> these letters as variable names)
>
> put X / Y into tRatio
> put tRatio * (item 1 of B - item 1 of A) into Cx
> put tRatio * (item 2 of B - item 2 of A) into Cy
> put Cx & comma & Cy into C
>
> > 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.
>
> This is exactly the same problem as 1). Just substitute the radius
> of the circle for distance X
>
> James P. Spencer
> Rochester, MN
>
> jspencer78 at charter.net
>
> "Badges?? We don't need no stinkin badges!"
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list