Hard Light Productions Forums

General FreeSpace => FreeSpace Discussion => Topic started by: Kazan on April 08, 2001, 10:50:00 am

Title: Eureka!
Post by: Kazan on April 08, 2001, 10:50:00 am
Gnudson's code: [translated to my varaible types... but his math is the same still]

vector FigureNormal(apvector Verts, int index1, int index2, int index3)
{
vector v1, v2, ret;


v1.x = Verts[index1].x - Verts[index2].x;
v1.y = Verts[index1].y - Verts[index2].y;
v1.z = Verts[index1].z - Verts[index2].z;

v2.x = Verts[index2].x - Verts[index3].x;
v2.y = Verts[index2].y - Verts[index3].y;
v2.z = Verts[index2].z - Verts[index3].z;
   
ret.x = (v1.y * v2.z) - (v1.z * v2.y);
ret.y = (v1.z * v2.x) - (v1.x * v2.z);
ret.z = (v1.x * v2.y) - (v1.y * v2.x);

return ret;

}



My Code: [used his code and checked his work against documentation]

vector FigureNormal(apvector Verts, int index1, int index2, int index3)
{
vector v1, v2, ret;

/*
C.x = A.y*B.z - A.z*B.y;
C.y = A.z*B.x - A.x*B.z;
C.z = A.x*B.y - A.y*B.x;

I found Cross some information on the net on how to do this.. he crossed some things
*/

v1.x = Verts[index1].x - Verts[index2].x;
v1.y = Verts[index1].y - Verts[index2].y;
v1.z = Verts[index1].z - Verts[index2].z;

v2.x = Verts[index3].x - Verts[index2].x;
v2.y = Verts[index3].y - Verts[index2].y;
v2.z = Verts[index3].z - Verts[index2].z;

   
ret.x = (v1.y * v2.z) - (v1.z * 2.y);
ret.y = (v1.z * v2.x) - (v1.x * 2.z);
ret.z = (v1.x * v2.y) - (v1.y * 2.x);

return ret;

}


[edit]index1-index2, index3-index2, instead of index2-index1, index3-index2 - thanks Eternal one [he knows mobe about this than me][/edit]


he wasn't getting vectors with a common start point so they didn't form a plane so the normals corrupting and being weird angles isn't suprising

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon (//"http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?

[This message has been edited by Kazan (edited 04-08-2001).]
Title: Eureka!
Post by: Jabu on April 08, 2001, 10:59:00 am
Kazan's back  (http://dynamic.gamespy.com/~freespace/ubb/noncgi/biggrin.gif)
Title: Eureka!
Post by: Kazan on April 08, 2001, 11:01:00 am
you think  (http://dynamic.gamespy.com/~freespace/ubb/noncgi/smile.gif)

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?
Title: Eureka!
Post by: The Claw on April 08, 2001, 11:04:00 am
 
Quote
you think
Nah :P

------------------
"Supernova, ya supernova, supernova goes pop
supernova, ya think it's over but the supernova don't stop" PM5K
Death:"Arnold Judas Rimmer... your life is over. You will travel with me to the-"
#knees death in the groin#
Rimmer:"Remember matey, it's only the good that die young"
Kudoth, god of pointless educational programs.
Title: Eureka!
Post by: Arnav on April 08, 2001, 11:10:00 am
Yup oyah that code made a lot of sense to me!
Title: Eureka!
Post by: Shrike on April 08, 2001, 04:43:00 pm
Well I'm not sure what it means, but it's handy..... (http://dynamic.gamespy.com/~freespace/ubb/noncgi/wink.gif)
Title: Eureka!
Post by: Kazan on April 08, 2001, 04:47:00 pm
It's the math which figures this [ http://www.phy.syr.edu/courses/java-suite/crosspro.html ("http://www.phy.syr.edu/courses/java-suite/crosspro.html")  ]  out - the function name "FigureNormal" is literal

i just noticed that the template tags which are "<" and ">" got removed with their contents from apvector"<"vector">" on the function definitions

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?

[This message has been edited by Kazan (edited 04-08-2001).]
Title: Eureka!
Post by: Kazan on April 08, 2001, 04:50:00 pm
for the calculus http://www.physics.uoguelph.ca/tutorials/torque/Q.torque.cross.html ("http://www.physics.uoguelph.ca/tutorials/torque/Q.torque.cross.html")

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?
Title: Eureka!
Post by: Shrike on April 08, 2001, 04:59:00 pm
No mentioning calculus or I own this thread.  I have a calc 154 final tomorrow.  (http://dynamic.gamespy.com/~freespace/ubb/noncgi/tongue.gif)
Title: Eureka!
Post by: Kazan on April 08, 2001, 05:01:00 pm
hehe.. I've got pre calc work to do.. 3 or 4 assignments by tommorow. OH S*** I just remembered my fragging LA assignemnt F*** I have to get that rough draft done or I lose 2/5th of the assignment points automatically! F***!

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?
Title: Eureka!
Post by: Bobboau on April 08, 2001, 06:49:00 pm
well I guess he isn't going to get PCS done today  (http://dynamic.gamespy.com/~freespace/ubb/noncgi/wink.gif)

------------------
Bobboau, bringing you products that work.............. in theory
Title: Eureka!
Post by: Kazan on April 08, 2001, 07:00:00 pm
nor within the next month.. it's not easy

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?
Title: Eureka!
Post by: NeoHunter on April 09, 2001, 08:39:00 am
I don't understand a word or number or formmula Kazan wrote there. Probably that's why I suck at Maths and Calculas. (http://dynamic.gamespy.com/~freespace/ubb/noncgi/biggrin.gif)

------------------
...and one day, Man will journey farther and faster into Space. - My thoughts

GTD Excellence  ("http://freespace.volitionwatch.com/excellence") Webmaster
NeoHunter<                      [b][email protected][/b]                                    >
Title: Eureka!
Post by: Bobboau on April 09, 2001, 09:53:00 am
its the cross product, it is used to find the normals for a polygon, beond that I don't know, as I have only a vage understanding of C++.

------------------
Bobboau, bringing you products that work.............. in theory
Title: Eureka!
Post by: Kazan on April 09, 2001, 02:38:00 pm
eternal observed that while my function _should_ work it will return 0 vectors, and well i saw this about 50% of the time.. hopefully eternal plays with it some more and tell's me more.. he understands this more than me

------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?
Title: Eureka!
Post by: The Claw on April 09, 2001, 03:45:00 pm
Hey, Kazan, if it's not too much trouble, can I ask that the next bit of codey-writing stuff u do for PCS is the .3ds to .pof conversion?
And just out of interest, how are you going to allow sub-onjects from a 3ds file, if you see what i mean?

------------------
"Supernova, ya supernova, supernova goes pop
supernova, ya think it's over but the supernova don't stop" PM5K
Death:"Arnold Judas Rimmer... your life is over. You will travel with me to the-"
#knees death in the groin#
Rimmer:"Remember matey, it's only the good that die young"
Kudoth, god of pointless educational programs.
Title: Eureka!
Post by: Kazan on April 09, 2001, 06:25:00 pm
I was thinking about 3ds to pof.. but since i don't use it i'll prolly not write the conversion myself [maybe someone else can write it and ill put it in the program].

a) i don't use it
b) i don't know alot about it [see 1]


------------------
FreeSpace 2: The Babylon Project Effects Nerd and Programmer.
http://freespace.volitionwatch.com/babylon ("http://freespace.volitionwatch.com/babylon")

Did you say you wanted your head used as a soccer ball?
Title: Eureka!
Post by: Fineus on April 10, 2001, 12:34:00 pm
It would be nice if you could write a 3DS to pof (or a LW to pof), It sure would save people a lot of time when making models... but I see what you mean about not using/knowing much about it.

------------------
  - ICQ: 57179504
Webmaster: Hard Light Productions ("http://www.3dap.com/hlp/")
Fight the future!
Title: Eureka!
Post by: The Claw on April 10, 2001, 01:12:00 pm
Maybe each seperate mesh could be a sub-object. It would sure beat the hell outta having to glue lights to everything, which I still havn't figured...

------------------
"Supernova, ya supernova, supernova goes pop
supernova, ya think it's over but the supernova don't stop" PM5K
Death:"Arnold Judas Rimmer... your life is over. You will travel with me to the-"
#knees death in the groin#
Rimmer:"Remember matey, it's only the good that die young"
Kudoth, god of pointless educational programs.
Title: Eureka!
Post by: Bobboau on April 10, 2001, 11:34:00 pm
the light thing is becase TS don't have no parent child system, it just has siblings, so to make a turret a subobject of the hull you have to make it a subobject of another object (the turret and a light, and abstract object) and make that object a sibling to the hullso you don't make it the child of the hull you make it the child of a sibling to the hull.

hope that cleared everything up for you  (http://dynamic.gamespy.com/~freespace/ubb/noncgi/biggrin.gif)

------------------
Bobboau, bringing you products that work.............. in theory