Results 1 to 3 of 3
Thread: Vector Math
 01272014, 04:30 AM #1▼ dafuq did I do?
 Join Date
 Dec 2013
 Posts
 203
 Rep Power
 0
Vector Math
I am running into some trouble with LinePlane intersection, my method works, provided I am perpendicular to the plane I want to intersect. This is caused be the plane equation (with my given x, y, and z coordinates, the equation is Z  1 = 0). So the equation is only relying on the Z value of anything inputted. Is there another way to calculate the equation of a plane that would rely on all axes? Here is my current code:
Java Code:Vector3f A = new Vector3f(0, 0, 1); Vector3f B = new Vector3f(0, 1, 1); Vector3f C = new Vector3f(1, 1, 1); Vector3f v1 = new Vector3f(B.x  A.x, B.y  A.y, B.z  A.z); Vector3f v2 = new Vector3f(C.x  A.x, C.y  A.y, C.z  A.z); float[] i = new float[]{v1.x, v2.x}; float[] j = new float[]{v1.y, v2.y}; float[] k = new float[]{v1.z, v2.z}; float a = (j[0] * k[1])  (j[1] * k[0]); float b = (i[0] * k[1])  (i[1] * k[0]); float c = (i[0] * j[1])  (i[1] * j[0]); float eX = ((a * C.x)); float eY = ((b * C.y)); float eZ = ((c * C.z)); Vector3f v3 = start; Vector3f v4 = new Vector3f(end.x  v3.x, end.y  v3.y, end.z  v3.z); float tX = v4.x, tY = v4.y, tZ = v4.z; float x, y, z; float rem = (((a * v3.x) + eX + (b * v3.y) + eY + (c * v3.z) + eZ)); float t = rem / (tX + tY + tZ); x = v3.x + (tX * t); y = v3.y + (tY * t); z = v3.z + (tZ * t); Vector3f v5 = new Vector3f(x, y, z);
Last edited by zFollette; 01272014 at 04:36 AM.
1000011 1100001 1101110 100000 1111001 1101111 1110101 100000 1110010 1100101 1100001 1100100 100000 1000010 1101001 1101110 1100001 1110010 1111001 111111
 01272014, 12:45 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,336
 Blog Entries
 7
 Rep Power
 20
 01272014, 10:07 PM #3▼ dafuq did I do?
 Join Date
 Dec 2013
 Posts
 203
 Rep Power
 0
Similar Threads

Doing Math
By nicholas205 in forum New To JavaReplies: 1Last Post: 01282012, 02:18 AM 
math and GUI
By urbanleg in forum AWT / SwingReplies: 3Last Post: 08062011, 04:05 PM 
Create Math.sin without math.sin
By vudoo in forum New To JavaReplies: 11Last Post: 12072010, 06:23 AM 
Vector<vector> loop thru
By ocean in forum New To JavaReplies: 11Last Post: 11212009, 02:17 PM 
Vector<Point2D> list = new Vector<Point2D>();Is it possible for 15,000 Point2D obj???
By Mazharul in forum Java 2DReplies: 1Last Post: 04062009, 06:45 AM
Bookmarks