3 Vertices

Blitz3D Forums/Blitz3D Programming/3 Vertices

When I do a cameraPick To Get Picked Triangle, I can obviously Get The 3 Vertices That Make Up That Triangle, What I can't figure out is, How to get the Whole Square. When looking top down on a Mesh, in wireframe. The Triangles Hypotenuse matches up with another Triangle. I want that Other Triangle 3 Vertices.

Make Sense?

Thanks in Advance for any help,
Eric

But since you can have a triangle attached to _any_ of the three edges, there seems to be a greater problem - which one?
Sorry.

Is the mesh just a grid of squares?

If it is and the triangles are all in sequential order you could just use some arbitrary math to decide which triangle shares this triangles hypot.

If you can decide which 2 vertices form the hypot you could use them to find the triangle that is made of this 2 vertices and a 3rd as only 1 possible triangle can share them normally.

John, There is one one Hyponeuse of a triangle. So It would be the other triangle that shares the same hypotenuse.

Shambler Any Ideas on how to do that?

Maybe he meant something like this.

ThisTri = Pickedtriangle()
If ThisTri And 1 Then OtherTri = ThisTri+1 Else OtherTri = ThisTri-1

DJ,

Can you please give me just a little more Guidance, Maybe I should have posted in the beginners section.

Regard,
Eric

DJ, in a grid, that's perfect. He needs to use the pic coords to get the domain of the quad he is in.

DJ,

I thanks, I got it, But I had to Change it to
ThisTri = PickedTriangle()
If ThisTri And 1 Then OtherTri = ThisTri(-)1 Else OtherTri = ThisTri(+)1

The Signs We backward for my program.

Regards,
Eric

Yes, my fault, I forgot the tri index starts at 0.

So I can Actually Learn something, Can you explain how this works?

Basically the first 'square' will be made up of triangle 0 and 1, the second is triangle 2 and 3 and so on.

So, if your pick returns an even number triangle then the other triangle that makes up the square will be the next triangle in the mesh 'ThisTri+1' but if the pick returns an odd number triangle then the other triangle making up the square will be the previous triangle 'ThisTri-1'

BTW in case you are not familiar with binary stuff, ThisTri And 1 checks if bit 0 of the index number is set, as it will be for all odd numbers. In Binary, Decimal 1=1, 2=10, 3=11, 4=100, 5=101 and so on. The AND operator in blitz performs a bitwise AND which returns a result that has bits set only if those bits are set in both the operands. The if condition evaluates any non zero Integer result as true.

Thanks for the explaination.

Regards,
ERic