Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

 
First page  Go to the previous page   [01]  [02]  [03]  Go to the next page  Last page
 
anybody know their math?
show user profile  Mr_Stabby
i've run into a bit of a snag given that my 6th grade math skills don't seem to be cutting it anymore

im trying to define a plane, i managed to do it by defining 3 points on the plane like this
p1, p2, p3 are the points
tan1 = (p2.y-p1.y)/(p2.x-p1.x)
tan2 = (p3.y-p1.y)/(p3.x-p1.x)
tanp1 = (p2.z-p1.z) / distance between p1 and p2
tanp2 = (p3.z-p1.z) / distance between p1 and p3

after that i can give the plane xy points and it can calculate the Z like this
pivotZ + tanp1 * sqrt(pow(x, 2) + pow( tan1 * x, 2)) - ( tan1 * x - y) * ( tanp1 * sqrt(pow(x, 2) + pow(tan1*x, 2))- tanp2 * sqrt(pow(x, 2) + pow(tan2 * x, 2))) / (tan1 * x - tan2*x)
(if x is 0 can swap x and y and tan1, 2 = 1/tan 1, 2)

then i realized that that must be the clunkiest implementation of a plane.. ever :p afaik you should only need Z, xAngle and yAngle to define any plane and made a constructor/z calculator based on that. now i have these 2 definitions of a plane but i want to be able to cross from one to another but im having a real hard time figuring it out since i think im out of linear math depth so basically..

how do you go from p1, p2, p3 to Z, normal vector? i tried google and wikipedia but meh its full of all kinds of weird signs and doesnt make any sense to me :/


read 866 times
10/9/2011 5:22:14 AM (last edit: 10/9/2011 5:22:14 AM)
show user profile  nm8r


read 852 times
10/9/2011 8:00:20 AM (last edit: 10/9/2011 8:04:43 AM)
show user profile  Garp
You want to search for cross product.

In a coconutshell, if you have three points A(Ax,Ay,Az), B(Bx,By,Bz) and C(Cx,Cy,Cz), the normal vector V(Vx,Vy,Vz) is such that:
Vx = (By-Ay)(Cz-Az) - (Bz-Az)(Cy-Ay)
Vy = (Bz-Az)(Cx-Ax) - (Bx-Ax)(Cz-Az)
Vz = (Bx-Ax)(Cy-Ay) - (By-Ay)(Cx-Ax)
So V is perpendicular to (ABC), pointing towards you if you see ABC in CCW order (right-hand rule) and with a length that's twice the surface of the triangle ABC.




read 843 times
10/9/2011 8:18:39 AM (last edit: 10/9/2011 8:19:30 AM)
show user profile  advance-software
you usually define a plane using the normal to the plane & the distance from the origin along that normal to the intersection of the plane.

P=(N,d) - so that's 4 floats.
read 835 times
10/9/2011 8:53:18 AM (last edit: 10/9/2011 9:03:12 AM)
show user profile  Garp
quote: how do you go from p1, p2, p3 to Z, normal vector?




read 833 times
10/9/2011 8:56:47 AM (last edit: 10/9/2011 8:56:47 AM)
show user profile  advance-software
hang on. not enough caffeine yet.

plane normal using cross product as you said.

haven't checked this is correct, but it's something like this :

http://paulbourke.net/geometry/planeeq/

read 827 times
10/9/2011 9:02:55 AM (last edit: 10/9/2011 9:05:47 AM)
show user profile  digital3ds
thats some 6th grade class
- Mike Sawicki




read 821 times
10/9/2011 9:05:24 AM (last edit: 10/9/2011 9:05:24 AM)
show user profile  Garp
Hang on too. I'm having tea.

Could be that Stabby's points are not defined by cartesian coordinates (?).

@digital3ds: I know. That's feckin old!




read 818 times
10/9/2011 9:07:28 AM (last edit: 10/9/2011 9:08:27 AM)
show user profile  advance-software
if they're not he can convert them. tea #3. need to get to around 10 before I start doing anything remotely useful.
read 811 times
10/9/2011 9:11:54 AM (last edit: 10/9/2011 9:13:14 AM)
show user profile  advance-software
here you go :

http://tog.acm.org/resources/GraphicsGems/gemsiii/newell.c

read 806 times
10/9/2011 9:15:50 AM (last edit: 10/9/2011 9:15:58 AM)
show user profile  Garp
That's exactly what I posted!
Except I used vectors AB and AC intead of u and v.




read 801 times
10/9/2011 9:21:06 AM (last edit: 10/9/2011 9:21:23 AM)
show user profile  advance-software
well then either they're both wrong in exactly the same way or he has what he needs.

can I get back to breakfast now ?

:)

read 798 times
10/9/2011 9:22:03 AM (last edit: 10/9/2011 9:29:44 AM)
show user profile  Mr_Stabby
thanks guys, i think thats what i need all though my initial implementation resulted in disaster but its too late here anyway try again tomorrow!

read 772 times
10/9/2011 10:29:54 AM (last edit: 10/9/2011 10:29:54 AM)
show user profile  gogodr
Let p1=(x1, y1, z1), p2=(x2, y2, z2), and p3=(x3, y3, z3) be non-colinear points.

(X-x1)(Y-y2)(Z-z3)+(Y-y1)(Z-z2)(X-x3)+(Z-z1)(Y-y2)(Y-y3)-(Z-z1)(Y-y2)(X-x3)-(Y-y1)(X-x2)(Z-z3)-(X-x1)(Z-z2)(Y-y3)=0

this should do it.

how did I came up with the formula?

this is a method to use this determinant and get all the points that makes the plane

|x-x1 y-y1 z-z1|
|x-x2 y-y2 z-z2| = 0
|x-x3 y-y3 z-z3|


:: random pony heavy gif alert ::

Hello there

beautiful ;3


read 755 times
10/9/2011 12:12:25 PM (last edit: 10/9/2011 12:36:06 PM)
show user profile  9krausec
that's called a matrix, right gogodr? Been a while since I dinked with math.




- Portfolio-




read 699 times
10/9/2011 11:38:35 PM (last edit: 10/9/2011 11:38:35 PM)
 
First page  Go to the previous page   [01]  [02]  [03]  Go to the next page  Last page
 
#Maxforums IRC
Open chat window


Support Maxforums.org