### Author Topic: Eureka!  (Read 5388 times)

0 Members and 1 Guest are viewing this topic.

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
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;

}

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

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

[This message has been edited by Kazan (edited 04-08-2001).]
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### Jabu

• One of our many cases
• 29
Kazan's back

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
you think

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

Did you say you wanted your head used as a soccer ball?
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### The Claw

• Run! Chickens Incoming!
• 27
##### Eureka!

Quote
you think
Nah

------------------
"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.
"I love the English for three reasons. One, we always beat you at rugby. Two, your wives are always friendly. Three you fought like devils to save us" Old French bloke at my uncles pub.
"One has plenty of time for contemplation while waiting for the endless waves of bad doggie werewolf monsters that chew your toes while you sleep"-Dradeel, BG2

#### Arnav

• Slightly rusty technology
• 27
• 2
##### Eureka!
Yup oyah that code made a lot of sense to me!
- Arnav
Creator of Technological Superiority: http://www.3dap.com/hlp/hosted/techsup
"At least I have job" - Unidentified Soviet Flak Trooper before being prismed.

#### Shrike

• 211
##### Eureka!
Well I'm not sure what it means, but it's handy.....
WE ARE HARD LIGHT PRODUCTIONS. YOU WILL LOWER YOUR FIREWALLS AND SURRENDER YOUR KEYBOARDS. WE WILL ADD YOUR INTELLECTUAL AND VERNACULAR DISTINCTIVENESS TO OUR OWN. YOUR FORUMS WILL ADAPT TO SERVICE US. RESISTANCE IS FUTILE.

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
It's the math which figures this [ 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

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

[This message has been edited by Kazan (edited 04-08-2001).]
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
for the calculus 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

Did you say you wanted your head used as a soccer ball?
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### Shrike

• 211
##### Eureka!
No mentioning calculus or I own this thread.  I have a calc 154 final tomorrow.
WE ARE HARD LIGHT PRODUCTIONS. YOU WILL LOWER YOUR FIREWALLS AND SURRENDER YOUR KEYBOARDS. WE WILL ADD YOUR INTELLECTUAL AND VERNACULAR DISTINCTIVENESS TO OUR OWN. YOUR FORUMS WILL ADAPT TO SERVICE US. RESISTANCE IS FUTILE.

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
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

Did you say you wanted your head used as a soccer ball?
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### Bobboau

• Just a MODern kinda guy
Just MODerately cool
And MODest too
• 213
##### Eureka!
well I guess he isn't going to get PCS done today

------------------
Bobboau, bringing you products that work.............. in theory
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3

DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
nor within the next month.. it's not easy

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

Did you say you wanted your head used as a soccer ball?
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### NeoHunter

• Primo Novus Venator
• 28
##### Eureka!
I don't understand a word or number or formmula Kazan wrote there. Probably that's why I suck at Maths and Calculas.

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

GTD Excellence Webmaster
NeoHunter<                      [b][email protected][/b]                                    >

#### Bobboau

• Just a MODern kinda guy
Just MODerately cool
And MODest too
• 213
##### Eureka!
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
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3

DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
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

Did you say you wanted your head used as a soccer ball?
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### The Claw

• Run! Chickens Incoming!
• 27
##### Eureka!
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.
"I love the English for three reasons. One, we always beat you at rugby. Two, your wives are always friendly. Three you fought like devils to save us" Old French bloke at my uncles pub.
"One has plenty of time for contemplation while waiting for the endless waves of bad doggie werewolf monsters that chew your toes while you sleep"-Dradeel, BG2

#### Kazan

• PCS2 Wizard
• 212
• Soul lives in the Mountains
##### Eureka!
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 about it [see 1]

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

Did you say you wanted your head used as a soccer ball?
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

#### Fineus

• I broke this.
• 212
##### Eureka!
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
Fight the future!

#### The Claw

• Run! Chickens Incoming!
• 27
##### Eureka!
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.
"I love the English for three reasons. One, we always beat you at rugby. Two, your wives are always friendly. Three you fought like devils to save us" Old French bloke at my uncles pub.
"One has plenty of time for contemplation while waiting for the endless waves of bad doggie werewolf monsters that chew your toes while you sleep"-Dradeel, BG2

#### Bobboau

• Just a MODern kinda guy
Just MODerately cool
And MODest too
• 213
##### Eureka!
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

------------------
Bobboau, bringing you products that work.............. in theory
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3

DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together