I do not seem the right thing. something I did not understand.
original code
from page
http://dtimofeev.blogspot.com/search?updated-max=2009-07-17T14%3A21%3A00%2B04%3A00&max-results=7
namespace Test
{
public class TestMath2
{
public TestMath2 ()
{
// Vertices of a triangle
Vector3 A = new Vector3 (1f,-1f, 0f);
Vector3 B = new Vector3 (3f,-4f, 0f);
Vector3 C = new Vector3 (5f,-1f, 0f);
// Texture coordinates of vertices
Vector2 tA = new Vector2 (1f, 1f);
Vector2 tB = new Vector2 (3f, 4f);
Vector2 tC = new Vector2 (5f, 1f);
// Point in the plane of the triangle bounded by its faces
Vector3 D = new Vector3 (3f,-2f, 0f);
// B
// .
// / \
// / \
// / \
// / .D \
// / \
// .-----------.
// A C
// Calculation
Vector2 tD = CalculationDuvFromABC (A, tA, B, tB, C, tC, D);
}
// /
// / Finding the texture coordinates of the point D
// /
// / The position of point A
// / Texture coordinates of point A
// / The position of point B
// / Texture coordinates of point B
// / The position of point C
// / Texture coordinates of C
// / The position of point D
// / Texture coordinates of D
private Vector2 CalculationDuvFromABC (Vector3 A, Vector2 tA, Vector3 B, Vector2 tB, Vector3 C, Vector2 tC, Vector3 D)
{
Vector3 E = PointOfLinesCrossing (A, B, C, D);
float kAEC = (E - A). Length () / (C - A). Length ();
Vector2 tE = tA (tC - tA) * kAEC;
float kBDE = (D - B). Length () / (E - B). Length ();
return (Vector2) (tB (tE - tB) * kBDE);
}
// /
// / Finding the position of the point of intersection of two lines
// / Pass through the points AC and BD
// /
// / The position of point A
// / The position of point B
// / The position of point C
// / The position of point D
// / The position of point E, obtained by the intersection of two straight lines AC and BD
private Vector3 PointOfLinesCrossing (Vector3 A, Vector3 B, Vector3 C, Vector3 D)
{
Vector3 vecAC = C - A;
Vector3 vecBD = D - B;
float Tac = Math.Abs (Matrix2x2Determinant (vecBD.X, AX - BX,vecBD.Y, A.Y - B.Y)/Matrix2x2Determinant (vecBD.X, vecAC.X,vecBD.Y, vecAC.Y));
return Vector3.Add (A, Vector3.Multiply (vecAC, Tac));
}
// /
// / Determinant of a 2x2
// /
// / A00
// / A01
// / A10
// / A11
// / Key
private float Matrix2x2Determinant (float a00, float a01,float a10, float a11)
{
return (float) (a00 * a11 - a10 * a01);
}
}
}
my code
function CalculationDuvFromABC(VcA, VctA, VcB, VctB, VcC, VctC, VcD)
PointOfLinesCrossing(VcA, VcB, VcC, VcD)
SET VECTOR3 VcE , X VECTOR3(retvect3), Y VECTOR3(retvect3), Z VECTOR3(retvect3)
vla#=LENGTH VECTOR3(VcE)-LENGTH VECTOR3(VcA)
vlb#=LENGTH VECTOR3(VcC)-LENGTH VECTOR3(VcA)
kAEC# = vla# / vlb#
SUBTRACT VECTOR2 retvect2 , VctC, VctA
MULTIPLY VECTOR2 VctA, kAEC#
MULTIPLY VECTOR2 retvect2, kAEC#
COPY VECTOR2 VctE, VctA
vla2#=LENGTH VECTOR3(VcD)-LENGTH VECTOR3(VcB)
vlb2#=LENGTH VECTOR3(VcE)-LENGTH VECTOR3(VcB)
kBDE# = vla2# / vlb2#
SUBTRACT VECTOR2 retvect2 , VctE, VctB
MULTIPLY VECTOR2 VctB, kBDE#
MULTIPLY VECTOR2 retvect2, kBDE#
COPY VECTOR2 retvect2, VctB
endfunction
function PointOfLinesCrossing( VcA, VcB, VcC, VcD)
SUBTRACT VECTOR3 vecAC , VcC, VcA
SUBTRACT VECTOR3 vecBD , VcD, VcB
Tac# = Abs(Matrix2x2Determinant(X VECTOR3(vecBD),X VECTOR3(VcA)-X VECTOR3(VcB),y VECTOR3(vecBD),y VECTOR3(VcA)-y VECTOR3(VcB))/Matrix2x2Determinant ( X VECTOR3(vecBD),X VECTOR3(vecAC),X VECTOR3(vecBD),X VECTOR3(vecAC)))
MULTIPLY VECTOR3 vecAC, Tac#
ADD VECTOR3 retvect3 , VcA , vecAC
endfunction
function Matrix2x2Determinant( a00 as float, a01 as float, a10 as float, a11 as float)
vvb# = (a00 * a11 - a10 * a01)
endfunction vvb#
my all program
`%ProjectTitle%
`======================
`©%Author%
`======================
`Main Source File
sync on
sync rate 0
autocam off
global tolerance#
tolerance# = 0.0001
type vertex
x as float
y as float
z as float
endtype
type vect
x as float
y as float
z as float
endtype
global VcA
global VcB
global VcC
global VctA
global VctB
global VctC
global VcD
global retvect3
global retvect2
global VcE
global VctE
global vecAC
global vecBD
global sou
sou=1
global jjj
global dim trisss(20) as string
global Aver as vertex
global B as vertex
global C as vertex
global P as vertex
global N as vertex
global BA as vertex
global CA as vertex
global PA as vertex
r=make vector3(1)
r=make vector3(2)
r=make vector3(3)
r=make vector3(4)
r=make vector3(5)
r=make vector3(6)
r=make vector3(7)
r=make vector3(8)
type triangle
xa1 as float
ya1 as float
za1 as float
u1 as float
v1 as float
xa2 as float
ya2 as float
za2 as float
u2 as float
v2 as float
xa3 as float
ya3 as float
za3 as float
u3 as float
v3 as float
dist as float
dif1 as integer
dif2 as integer
dif3 as integer
index1 as integer
index2 as integer
index3 as integer
nxa1 as float
nya1 as float
nza1 as float
nxa2 as float
nya2 as float
nza2 as float
nxa3 as float
nya3 as float
nza3 as float
endtype
global tri
global xp as float
global yp as float
global zp as float
xp=0.0
yp=0.0
zp=0.0
global ab
global x1 as float
global y1 as float
global z1 as float
global x2 as float
global y2 as float
global z2 as float
global x0 as float
global y0 as float
global z0 as float
global s as float
global s1 as float
global s2 as float
global s3 as float
global dt as float
global uu as float
global dx as float
global dy as float
global dz as float
global vc
global ic
global dis as float
global move as float
move=0.0
load object "1.x",2
position object 2,move,0,move
global ShotImg
ShotImg=100
load image "exit.dds",ShotImg
load image "2.dds",1
load image "3.dds",2
load image "4.dds",3
load image "5.dds",4
load image "6.dds",5
load image "7.dds",6
GLOBAL TempImg AS INTEGER : TempImg = 5
load object "3.x",5
texture object 2,ShotImg
SET OBJECT TRANSPARENCY 2, 3
position camera -200,50,-200
point camera move,0,move
set object ambient 5,0
make mesh from object 1,2
lock vertexdata for mesh 1
`lock vertexdata for limb 2,0
Ic= GET VERTEXDATA INDEX COUNT()
Vc= GET VERTEXDATA vertex COUNT()
dim indecindex(ic)
tri=(ic)/3
dim tris( tri ) as triangle
for i=1 to ic
indecindex(i)=get indexdata(i-1)
next i
for h=1 to tri
tris(h).xa1= GET VERTEXDATA POSITION X( indecindex(h*3-2) )
tris(h).ya1= GET VERTEXDATA POSITION y( indecindex(h*3-2) )
tris(h).za1= GET VERTEXDATA POSITION z( indecindex(h*3-2) )
tris(h).u1= GET VERTEXDATA u( indecindex(h*3-2) )
tris(h).v1= GET VERTEXDATA v( indecindex(h*3-2) )
set vertexdata diffuse indecindex(h*3-2) ,rgb(255,255,255)
tris(h).dif1= get vertexdata diffuse(indecindex(h*3-2))
tris(h).index1=indecindex(h*3-2)
tris(h).xa2= GET VERTEXDATA POSITION X( indecindex(h*3-1) )
tris(h).ya2= GET VERTEXDATA POSITION y( indecindex(h*3-1) )
tris(h).za2= GET VERTEXDATA POSITION z( indecindex(h*3-1) )
tris(h).u2= GET VERTEXDATA u( indecindex(h*3-1) )
tris(h).v2= GET VERTEXDATA v( indecindex(h*3-1) )
set vertexdata diffuse indecindex(h*3-1) ,rgb(255,255,255)
tris(h).dif2= get vertexdata diffuse(indecindex(h*3-1))
tris(h).index2=indecindex(h*3-1)
tris(h).xa3= GET VERTEXDATA POSITION X( indecindex(h*3) )
tris(h).ya3= GET VERTEXDATA POSITION y( indecindex(h*3) )
tris(h).za3= GET VERTEXDATA POSITION z( indecindex(h*3) )
tris(h).u3= GET VERTEXDATA u( indecindex(h*3) )
tris(h).v3= GET VERTEXDATA v( indecindex(h*3) )
set vertexdata diffuse indecindex(h*3) ,rgb(255,255,255)
tris(h).dif3= get vertexdata diffuse(indecindex(h*3))
tris(h).index3=indecindex(h*3)
tris(h).nxa1= GET VERTEXDATA normals X( indecindex(h*3-2) )
tris(h).nya1= GET VERTEXDATA normals y( indecindex(h*3-2) )
tris(h).nza1= GET VERTEXDATA normals z( indecindex(h*3-2) )
tris(h).nxa2= GET VERTEXDATA normals X( indecindex(h*3-1) )
tris(h).nya2= GET VERTEXDATA normals y( indecindex(h*3-1) )
tris(h).nza2= GET VERTEXDATA normals z( indecindex(h*3-1) )
tris(h).nxa3= GET VERTEXDATA normals X( indecindex(h*3) )
tris(h).nya3= GET VERTEXDATA normals y( indecindex(h*3) )
tris(h).nza3= GET VERTEXDATA normals z( indecindex(h*3) )
next h
UNLOCK VERTEXDATA
ab= 1024
global mx
global my
global mcli
global mmz
do
set cursor 0,0
mcli=mouseclick()
mx=mousex()
my=mousey()
mmz=mousemovez()
dis=0
if pick object(mx,my,2,2)>0
dis=get pick distance()
xp=get pick vector x():yp=get pick vector y():zp=get pick vector z()
endif
pick screen mx,my,dis
dx=get pick vector x()+camera position x():dy=get pick vector y()+camera position y():dz=get pick vector z()+camera position z()
intriangle=0
if dis>0
for jjj=1 to tri
w# = onplane( tris(jjj).xa1,tris(jjj).ya1,tris(jjj).za1,tris(jjj).xa2,tris(jjj).ya2,tris(jjj).za2, tris(jjj).xa3,tris(jjj).ya3,tris(jjj).za3,(dx-move),dy,(dz-move) )
if abs(w#)<= tolerance#
dde=PinTRI(abs(w#) )
if dde>0 then intriangle=jjj:goto ext
if dde=2 then end:exit
endif
next jjj
ext:
text 800,10,str$(intriangle)
text 800,30,str$(uu)
text 800,50,str$(dx)
text 800,70,str$(dy)
text 800,90,str$(dz)
d3d_line3d (tris(intriangle).xa1)+move ,(tris(intriangle).ya1),(tris(intriangle).za1)+move ,(tris(intriangle).xa2)+move ,(tris(intriangle).ya2),(tris(intriangle).za2)+move ,rgb(255,0,0),0
d3d_line3d (tris(intriangle).xa2)+move ,(tris(intriangle).ya2),(tris(intriangle).za2)+move ,(tris(intriangle).xa3)+move ,(tris(intriangle).ya3),(tris(intriangle).za3)+move ,rgb(0,255,0),0
d3d_line3d (tris(intriangle).xa3)+move ,(tris(intriangle).ya3),(tris(intriangle).za3)+move ,(tris(intriangle).xa1)+move ,(tris(intriangle).ya1),(tris(intriangle).za1)+move ,rgb(0,0,255),0
position object 5,(tris(intriangle).xa1)+move ,(tris(intriangle).ya1),(tris(intriangle).za1)+move
if keystate(57)=1
// Vertices of a triangle
VcA = new Vector3 (tris(intriangle).xa1,tris(intriangle).ya1, tris(intriangle).za1)
VcB = new Vector3 (tris(intriangle).xa2,tris(intriangle).ya2, tris(intriangle).za2)
VcC = new Vector3 (tris(intriangle).xa3,tris(intriangle).ya3, tris(intriangle).za3)
// Texture coordinates of vertices
VctA = new Vector2 ((tris(intriangle).u1), (tris(intriangle).v1))
VctB = new Vector2 ((tris(intriangle).u2), (tris(intriangle).v2))
VctC = new Vector2 ((tris(intriangle).u3), (tris(intriangle).v3))
// Point in the plane of the triangle bounded by its faces
VcD = new Vector3 (dx,dy, dz)
retvect3=new Vector3 ()
retvect2=new Vector2 ()
VcE = new Vector3 ()
VctE = new Vector2 ()
vecAC = new Vector3 ()
vecBD = new Vector3 ()
CalculationDuvFromABC(VcA, VctA, VcB, VctB, VcC, VctC, VcD)
xxx = x vector2(retvect2)*1024
yyy = y vector2(retvect2)*1024
ppc=image point(sou,xxx,yyy)
Image Dot ShotImg, xxx,yyy , ppc
delete vector2 VctA
delete vector2 VctB
delete vector2 VctC
delete vector2 retvect2
delete vector2 VctE
delete vector3 VcA
delete vector3 VcB
delete vector3 VcC
delete vector3 VcD
delete vector3 retvect3
delete vector3 VcE
delete vector3 vecAC
delete vector3 vecBD
endif
if mcli=1
obj=1000+intriangle
if object exist(obj)=0
MAKE OBJECT TRIANGLE obj, tris(intriangle).xa1+move, tris(intriangle).Ya1, tris(intriangle).Za1+move, tris(intriangle).xa2+move, tris(intriangle).Ya2, tris(intriangle).Za2+move, tris(intriangle).xa3+move, tris(intriangle).Ya3, tris(intriangle).Za3+move
set object normals obj
set object light obj,1
color object obj,rgb(255,0,0)
SET OBJECT Obj, 0, 0, 0, 0, 0, 0, 0
endif
endif
if mcli=2
obj=1000+intriangle
if object exist(obj)=1
delete object obj
endif
endif
endif
if controlkey()=1
for h=1 to tri
if object exist(1000+h)=1
d3d_line (tris(h).u1*ab) ,(tris(h).v1*ab) ,(tris(h).u2*ab) ,(tris(h).v2*ab) ,rgb(255,0,0)
d3d_line (tris(h).u2*ab) ,(tris(h).v2*ab) ,(tris(h).u3*ab) ,(tris(h).v3*ab) ,rgb(0,255,0)
d3d_line (tris(h).u3*ab) ,(tris(h).v3*ab) ,(tris(h).u1*ab) ,(tris(h).v1*ab) ,rgb(0,0,255)
else
d3d_line (tris(h).u1*ab) ,(tris(h).v1*ab) ,(tris(h).u2*ab) ,(tris(h).v2*ab) ,rgb(0,0,0)
d3d_line (tris(h).u2*ab) ,(tris(h).v2*ab) ,(tris(h).u3*ab) ,(tris(h).v3*ab) ,rgb(0,0,0)
d3d_line (tris(h).u3*ab) ,(tris(h).v3*ab) ,(tris(h).u1*ab) ,(tris(h).v1*ab) ,rgb(0,0,0)
endif
next h
else
endif
text 10,10, "Vc-"+str$( vc)
text 10,30, "Ic-"+str$( Ic)
text 10,50, "tri-"+str$( intriangle)
text 10,70, "dis-"+str$(dis)
text 10,90, "FPS-"+str$(screen fps())
text 10,110, "y-"+str$(ox#)
text 10,130, "y-"+str$(oy#)
text 10,150, "y-"+str$(oz#)
`control camera using arrowkeys 0,2,2
point camera 0,move,50,move
if mmz>0 then move camera up 0,3
if mmz<0 then move camera up 0,-3
if keystate(30)=1 then move camera left 0,0.2
if keystate(32)=1 then move camera left 0,-0.2
if keystate(17)=1 then move camera 0,0.2
if keystate(31)=1 then move camera 0,-0.2
if inkey$()="1" then sou=1
if inkey$()="2" then sou=2
if inkey$()="3" then sou=3
if inkey$()="4" then sou=4
if inkey$()="5" then sou=5
if inkey$()="6" then sou=6
if inkey$()="0" then save image "exit.dds",ShotImg
if mcli=4
for f=1 to tri
ll=4096
up=4096
rr=0
dd=0
if object exist(1000+f)=1
if tris(f).u1*ab<ll then ll=tris(f).u1*ab
if tris(f).u2*ab<ll then ll=tris(f).u2*ab
if tris(f).u3*ab<ll then ll=tris(f).u3*ab
if tris(f).u1*ab>rr then rr=tris(f).u1*ab
if tris(f).u2*ab>rr then rr=tris(f).u2*ab
if tris(f).u3*ab>rr then rr=tris(f).u3*ab
if tris(f).v1*ab<up then up=tris(f).v1*ab
if tris(f).v2*ab<up then up=tris(f).v2*ab
if tris(f).v3*ab<up then up=tris(f).v3*ab
if tris(f).v1*ab>dd then dd=tris(f).v1*ab
if tris(f).v2*ab>dd then dd=tris(f).v2*ab
if tris(f).v3*ab>dd then dd=tris(f).v3*ab
for xxx=ll-2 to rr+2
for yyy= up-2 to dd+2
av as vect : bv as vect : cv as vect : pv as vect
pv.x=xxx : pv.y=yyy
av.x=tris(f).u1*ab : av.y=tris(f).v1*ab
bv.x=tris(f).u2*ab : bv.y=tris(f).v2*ab
cv.x=tris(f).u3*ab : cv.y=tris(f).v3*ab
if PointInTRI(pv ,av ,bv ,cv )
////IK Copy Image 1000, Sou , xxx-1, yyy-1, xxx+1, yyy+1
////IK Paste Image On Image 1000, ShotImg , xxx-1, yyy-1
////IK Paste Image Channel 1000, ShotImg, 0xFF000000 , 0xFF000000 , xxx-1, yyy-1
ppc=image point(sou,xxx,yyy)
Image Dot ShotImg, xxx,yyy , ppc
` if xxx=ll+1 or yyy=up+1 or xxx=rr or yyy=dd
ppc=image point(sou,xxx-1,yyy)
Image Dot ShotImg, xxx-1,yyy , ppc
ppc=image point(sou,xxx-2,yyy)
Image Dot ShotImg, xxx-2,yyy , ppc
ppc=image point(sou,xxx-3,yyy)
Image Dot ShotImg, xxx-3,yyy , ppc
ppc=image point(sou,xxx,yyy-1)
Image Dot ShotImg, xxx,yyy-1 , ppc
ppc=image point(sou,xxx,yyy-2)
Image Dot ShotImg, xxx,yyy-2 , ppc
ppc=image point(sou,xxx,yyy-3)
Image Dot ShotImg, xxx,yyy-3 , ppc
ppc=image point(sou,xxx+1,yyy)
Image Dot ShotImg, xxx+1,yyy , ppc
ppc=image point(sou,xxx+2,yyy)
Image Dot ShotImg, xxx+2,yyy , ppc
ppc=image point(sou,xxx,yyy+1)
Image Dot ShotImg, xxx,yyy+1, ppc
ppc=image point(sou,xxx,yyy+2)
Image Dot ShotImg, xxx,yyy+2, ppc
ppc=image point(sou,xxx-1,yyy-1)
Image Dot ShotImg, xxx-1,yyy-1 , ppc
ppc=image point(sou,xxx+1,yyy+1)
Image Dot ShotImg, xxx+1,yyy+1 , ppc
` endif
endif
next yyy
next xxx
sync
endif
next f
endif
sync
loop
end
MAKE MEMBLOCK 1,1
function onplane( in1 as float,in2 as float,in3 as float,in4 as float,in5 as float,in6 as float,in7 as float,in8 as float,in9 as float,in10 as float,in11 as float,in12 as float )
Aver.x = in1 : Aver.y = in2 : Aver.z = in3
B.x = in4 : B.y = in5 : B.z = in6
C.x = in7 : C.y = in8 : C.z = in9
P.x = in10 : P.y = in11 : P.z = in12
setVector3(1, Aver)
setVector3(2, B)
setVector3(3, C)
setVector3(7, P)
subtract vector3 5, 2, 1 ` this is B-A
subtract vector3 6, 3, 1 ` this is C-A
subtract vector3 8, 7, 1 ` this is the vector P-A
cross product vector3 4,5,6
normalize vector3 4,4 ` this is the normal vector N
// calculate w value for testing whether P is inside the triangle
w# = dot product vector3 (8, 4) ` this is the dotproduct (P-A).N
endfunction w#
function PinTRI(w#)
// construct 2x2 matrix, etc, for solving the equations using standard least squares procedure
A11# = dot product vector3(5, 5)
A12# = dot product vector3(5, 6)
A22# = dot product vector3(6, 6)
B1# = dot product vector3(5, 8)
B2# = dot product vector3(6, 8)
// scale cefficients to reduce precision problems when testing determinant
factor# = 1.0/max(A11#, A22#)
A11# = A11#*factor#
A12# = A12#*factor#
A22# = A22#*factor#
B1# = B1#*factor#
B2# = B2#*factor#
BA.x = x vector3(5) : BA.y = y vector3(5) : BA.z = z vector3(5)
CA.x = x vector3(6) : CA.y = y vector3(6) : CA.z = z vector3(6)
PA.x = x vector3(8) : PA.y = y vector3(8) : PA.z = z vector3(8)
// compute determinant of 2x2 matrix
det# = A11#*A22# - A12#*A12#
if abs(det#) > tolerance#
` solve for u and v
u# = (A22#*B1# - A12#*B2#)/det#
v# = (-A12#*B1# + A11#*B2#)/det#
else
set cursor 0,0
ink rgb(255, 0, 0)
print " triangle may be degenerate - check vertices:"
print " A = ", Aver.x, " ", Aver.y, " ", Aver.z
print " B = ", B.x, " ", B.y, " ", B.z
print " C = ", C.x, " ", C.y, " ", C.z
sync
wait key
end
endif
if (u# >= -tolerance#) and (v# >= -tolerance#) and (u#+v# <= 1.0+tolerance#)
exitfunction 1
endif
endfunction 0
function setVector3(id, V as vertex)
set vector3 id, V.x, V.y, V.z
endfunction
function PointInTRI(pv as vect,av as vect,bv as vect,cv as vect)
v1 as integer
v2 as integer
v3 as integer
v1=SameSide(pv,av,bv,cv)
v2=SameSide(pv,bv,av,cv)
v3=SameSide(pv,cv,av,bv)
if v1=1 and v2=1 and v3=1
result=1
else
result=0
endif
endfunction result
function SameSide(p1 as vect,p2 as vect,av as vect,bv as vect)
t1 as vect : t2 as vect : t3 as vect
r1 as vect : r2 as vect
dotp as float
t1.x=bv.x-av.x
t1.y=bv.y-av.y
t2.x=p1.x-av.x
t2.y=p1.y-av.y
t3.x=p2.x-av.x
t3.y=p2.y-av.y
r1.z=(t1.x*t2.y) - (t1.y*t2.x)
r2.z=(t1.x*t3.y) - (t1.y*t3.x)
dotp=(r1.z*r2.z)
if dotp>=0
result=1
else
result=0
endif
endfunction result
function CalculationDuvFromABC(VcA, VctA, VcB, VctB, VcC, VctC, VcD)
PointOfLinesCrossing(VcA, VcB, VcC, VcD)
SET VECTOR3 VcE , X VECTOR3(retvect3), Y VECTOR3(retvect3), Z VECTOR3(retvect3)
vla#=LENGTH VECTOR3(VcE)-LENGTH VECTOR3(VcA)
vlb#=LENGTH VECTOR3(VcC)-LENGTH VECTOR3(VcA)
kAEC# = vla# / vlb#
SUBTRACT VECTOR2 retvect2 , VctC, VctA
MULTIPLY VECTOR2 VctA, kAEC#
MULTIPLY VECTOR2 retvect2, kAEC#
COPY VECTOR2 VctE, VctA
vla2#=LENGTH VECTOR3(VcD)-LENGTH VECTOR3(VcB)
vlb2#=LENGTH VECTOR3(VcE)-LENGTH VECTOR3(VcB)
kBDE# = vla2# / vlb2#
SUBTRACT VECTOR2 retvect2 , VctE, VctB
MULTIPLY VECTOR2 VctB, kBDE#
MULTIPLY VECTOR2 retvect2, kBDE#
COPY VECTOR2 retvect2, VctB
endfunction
function PointOfLinesCrossing( VcA, VcB, VcC, VcD)
SUBTRACT VECTOR3 vecAC , VcC, VcA
SUBTRACT VECTOR3 vecBD , VcD, VcB
Tac# = Abs(Matrix2x2Determinant(X VECTOR3(vecBD),X VECTOR3(VcA)-X VECTOR3(VcB),y VECTOR3(vecBD),y VECTOR3(VcA)-y VECTOR3(VcB))/Matrix2x2Determinant ( X VECTOR3(vecBD),X VECTOR3(vecAC),X VECTOR3(vecBD),X VECTOR3(vecAC)))
MULTIPLY VECTOR3 vecAC, Tac#
ADD VECTOR3 retvect3 , VcA , vecAC
endfunction
function Matrix2x2Determinant( a00 as float, a01 as float, a10 as float, a11 as float)
vvb# = (a00 * a11 - a10 * a01)
endfunction vvb#
.....already beside..... for all