#72830 - 2003-02-02 11:18 PM
Need math/geometry help.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
given a line with coordinates x1:y1 to x2:y2
I need a way to find the coordinates at some point at any given percent of the length
for example,
$segment=drawpercent($fromx,$fromy,$tox,$toy,50) $segx=$segment[0] $segy=$segment[1]
TIA [ 03. February 2003, 01:04: Message edited by: Radimus ]
|
|
Top
|
|
|
|
#72833 - 2003-02-03 04:41 AM
Re: Need math/geometry help.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
ok... that worked perfectly. Thanks
Pt. 2. This should be a bit harder...
given a point, and a length, and a 360 degree direction find the point.
$point=angleline($x,$y,$radius,$angle) $nextx=$point[0] $nexty=$point[1]
|
|
Top
|
|
|
|
#72836 - 2003-02-03 04:56 AM
Re: Need math/geometry help.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
any X,Y coordinate on the screen/image map... positive integer
Yep from a given point, in a given 0-359 degree angle, at a specified distance. find the x,y coordinates at that point
|
|
Top
|
|
|
|
#72842 - 2003-02-03 09:37 AM
Re: Need math/geometry help.
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
not tested this is... at least tested the sides code... a little.
check out does it work or not... no external dependencies.
function coord($x,$y,$dist,$deg) dim $ select case $deg=0 $coord=$x,$y+$dist case $deg=90 $coord=$x+$dist,$y case $deg=180 $coord=$x,$y-$dist case $deg=270 $coord=$x-$dist,$y case $deg<90 $=sides($dist,$deg) $coord=$x+$[1],$y+$[0] case $deg<180 $=sides($dist,$deg-90) $coord=$x+$[0],$y-$[1] case $deg<270 $=sides($dist,$deg-180) $coord=$x-$[1],$y-$[0] case 1 $=sides($dist,$deg-270) $coord=$x-$[0],$y+$[1] endfunction
function sides($1,$2) dim $,$3 $1=0.0+$1*$1 $3=90.0-$2 do $=0.01+$ until $1<($*$2)*($*$2)+($*$3)*($*$3) $sides=$*$3,$*$2 endfunction
{edit} updated code. [ 04. February 2003, 06:50: Message edited by: Lonkero ]
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#72844 - 2003-02-03 07:26 PM
Re: Need math/geometry help.
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
hey!! what is this complex math stuff!!! because everyone knows, kixtart is just a logon script language....
i knew that someone would find a use for the sqrt () Function
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 858 anonymous users online.
|
|
|