Walking over a 3d mesh

Started by
13 comments, last by Marvin 22 years, 6 months ago
Sorry for confusing you. I will try to explain it more. Here it goes. First. How to make line out of two points (x1,y1) and (x2,y2). The solution is this big awfull formula:

(y-y1) = ( (y2-y1)/(x2-x1) )*(x-x1)

Second, this y=a*x+b. I want to use a and b to have less typing.
(a and b are kind of temporary variables to store partial results). So I have to find out how a and b corresponds to x1,y1,x2,y2. This is what I meant by transforming equations.
I calculated that a = (y2-y1)/(x2-x1)
and b = y1 - (y2-y1)/(x2-x1)*x1
As a result we have an equation y=a*x+b which is easy to write (cause it is short ).

Now, do same trick with second line. If we have points (x3,y3) and (x4,y4) then equation is

(y-y3)= ( (y4-y3)/(x4-x3) )*(x-x3)

Then, change it to form y=c*x+d. It is the same as previous one so c = (y4-y3)/(x4-x3)
and d = y3 - (y4-y3)/(x4-x3)*x3

Now, to the intersection point. We have set of two equations
y=a*x+b
y=c*x+d
The point (x0,y0) which fullfils both these equation is intersetion point. In other words we are looking for such x) and y) that when you put x0 in first equation you will get y0 AND if you put same x0 to second equation you will get y0 again. Here are solutions for x0 and y0:
x0 = (b-d)/(c-a), y0 = c*( (b-d)/(c-a) ) + d

Procedure which finds intersection point has to do two steps.
First. Calculate a,b,c,d from x1,y1,.......,x4,y4
Second. Calculate x0,y0 from a,b,c,d

Well, I hope it clears things a bit (And I didnt bore you to death).

K.
Advertisement
hehe thanks thats far better, simultanious equations

ill let you know how i get on
I''m just curious, does this method produce a bezier curve, or is it just some other sort of nonspecific an unspecial curve?
KeithW: If you refer to my method (from my first post), I dont know what type of curve it creates/defines or if it even creates any curve.
Or I just dont understand your question .

K.
Hey Marvin, could you please give me your email address ? I gatta ask you something !!

Please.... (or you can send ME an email @ VanKurt@gmx.de)

Thx, VanKurt

This topic is closed to new replies.

Advertisement