• Create Account

### #Actualjuddo

Posted 08 November 2012 - 06:26 AM

thank you both for the replys. i think i know what i need to do, just not sure what order i need to read my vu and vv variables when alternating?

so to clarify for myself... for the first alternating read, what vertices do i want vu and vv to be? vu is 2-3? vv is 2-0? what about the second alternating read? vu is ?-? and vv is ?-? does the cross product also change on each alternating read? or just the vertices i read into vu and vv? i thought i had this in concrete, but the more sample code on calculating normals i find, the more confused i become. every source code calculating normals i find reads the vertices in a different order... i've now changed my vu vv and cross product dozens of times...!

correct me if i am wrong, going by the diagram the first read is vertex 1, 2 then 3. and the second read is 3, 4 then 2? cw then alternate ccw?

[source lang="cpp"]if (flip > 0) { flip = 0; vu[0] = vertices[1][x] - vertices[2][x]; vu[1] = vertices[1][y] - vertices[2][y]; vu[2] = vertices[1][z] - vertices[2][z]; vv[0] = vertices[1][x] - vertices[0][x]; vv[1] = vertices[1][y] - vertices[0][y]; vv[2] = vertices[1][z] - vertices[0][z];}else { flip = 1; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z]; vv[0] = vertices[?][x] - vertices[?][x]; vv[1] = vertices[?][y] - vertices[?][y]; vv[2] = vertices[?][z] - vertices[?][z];}[/source]

### #4juddo

Posted 08 November 2012 - 06:24 AM

thank you both for the replys. i think i know what i need to do, just not sure what order i need to read my vu and vv variables when alternating?

so to clarify for myself... for the first alternating read, what vertices do i want vu and vv to be? vu is 2-3? vv is 2-0? what about the second alternating read? vu is ?-? and vv is ?-? does the cross product also change on each alternating read? or just the vertices i read into vu and vv? i thought i had this in concrete, but the more sample code on calculating normals i find, the more confused i become. every source code calculating normals i find reads the vertices in a different order... i've now changed my vu vv and cross product dozens of times...!

correct me if i am wrong, going by the diagram the first read is vertex 1, 2 then 3. and the second read is 3, 4 then 2? cw then alternate ccw?

[source lang="cpp"]if (flip > 0) { flip = 0; vu[0] = vertices[1][x] - vertices[2][x]; vu[1] = vertices[1][y] - vertices[2][y]; vu[2] = vertices[1][z] - vertices[2][z]; vv[0] = vertices[1][x] - vertices[0][x]; vv[1] = vertices[1][y] - vertices[0][y]; vv[2] = vertices[1][z] - vertices[0][z];}else { flip = 1; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z]; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z];}[/source]

### #3juddo

Posted 08 November 2012 - 06:24 AM

thank you both for the replys. i think i know what i need to do, just not sure what order i need to read my vu and vv variables when alternating?

so to clarify for myself... for the first alternating read, what vertices do i want vu and vv to be? vu is 2-3? vv is 2-0? what about the second alternating read? vu is ?-? and vv is ?-? does the cross product also change on each alternating read? or just the vertices i read into vu and vv? i thought i had this in concrete, but the more sample code on calculating normals i find, the more confused i become. every source code calculating normals i find reads the vertices in a different order... i've now changed my vu vv and cross product dozens of times...!

correct me if i am wrong, going by the diagram the first read is vertex 1, 2 then 3. and the second read is 3, 4 then 2? cw then alternate ccw?

[source lang="cpp"]if (flip > 0) { flip = 0; vu[0] = vertices[1][x] - vertices[2][x]; vu[1] = vertices[1][y] - vertices[2][y]; vu[2] = vertices[1][z] - vertices[2][z]; vv[0] = vertices[1][x] - vertices[0][x]; vv[1] = vertices[1][y] - vertices[0][y]; vv[2] = vertices[1][z] - vertices[0][z];}else { flip = 1; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z]; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z];}[/source]

### #2juddo

Posted 08 November 2012 - 06:24 AM

thank you both for the replys. i think i know what i need to do, just not sure what order i need to read my vu and vv variables when alternating?

so to clarify for myself... for the first alternating read, what vertices do i want vu and vv to be? vu is 2-3? vv is 2-0? what about the second alternating read? vu is ?-? and vv is ?-? does the cross product also change on each alternating read? or just the vertices i read into vu and vv? i thought i had this in concrete, but the more sample code on calculating normals i find, the more confused i become. every source code calculating normals i find reads the vertices in a different order... i've now changed my vu vv and cross product dozens of times...!

correct me if i am wrong, going by the diagram the first read is vertex 1, 2 then 3. and the second read is 3, 4 then 2? cw then alternate ccw?

[source lang="cpp"]if (flip > 0) { flip = 0; vu[0] = vertices[1][x] - vertices[2][x]; vu[1] = vertices[1][y] - vertices[2][y]; vu[2] = vertices[1][z] - vertices[2][z]; vv[0] = vertices[1][x] - vertices[0][x]; vv[1] = vertices[1][y] - vertices[0][y]; vv[2] = vertices[1][z] - vertices[0][z];}else { flip = 1; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z]; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z];}[/source]

### #1juddo

Posted 08 November 2012 - 06:18 AM

thank you both for the replys. i think i know what i need to do, just not sure what order i need to read my vu and vv variables when alternating?

so to clarify for myself... for the first alternating read, what vertices do i want vu and vv to be? vu is 2-3? vv is 2-0? what about the second alternating read? vu is ?-? and vv is ?-?

correct me if i am wrong, going by the diagram the first read is vertex 1, 2 then 3. and the second read is 3, 4 then 2? cw then alternate ccw?

[source lang="cpp"]if (flip > 0) { flip = 0; vu[0] = vertices[1][x] - vertices[2][x]; vu[1] = vertices[1][y] - vertices[2][y]; vu[2] = vertices[1][z] - vertices[2][z]; vv[0] = vertices[1][x] - vertices[0][x]; vv[1] = vertices[1][y] - vertices[0][y]; vv[2] = vertices[1][z] - vertices[0][z];}else { flip = 1; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z]; vu[0] = vertices[?][x] - vertices[?][x]; vu[1] = vertices[?][y] - vertices[?][y]; vu[2] = vertices[?][z] - vertices[?][z];}[/source]

PARTNERS