I'm working on a project right now, but i've hit a complete stand-still. This problem has to deal with taking 2 3-dimensional models and putting them together, based on things I call "golden areas". I have defined this golden area to be a quadrilateral (ie rectangle) in which all the vertices are parallel on either the X or Y axis (not going to deal with Z axis. Forget that.)
In C#, my vertices are defined basically as any other (textured) vertice, with an XYZ for normals and an XYZ for position. I do believe that I won't have to do jack to the normals, however I do have to jack with the Positions of them all in order to do what I want to do.
The basic idea for my app is a level builder, based on predefined models. We can assume a number of things (or I'll go insane, mark my words) 1. All golden areas that are of certain sides will be marked with a tag. +garea## where ## is a number defining the gareas that can attach to them (all garea00's will only attach to other garea00's).
(the below is the reason I'm posting for help!)
Now, here's the real problem(s) I have to determine how much I have to rotate the whole model. This rotation is called yaw.
Thus I gotta somehow use a method so I can find the orientation of the model, such that whenever it is rotated, I won't have, say, a model intersecting a model (ie a box inside a box).
here's a very, very basic example of what I want to do:
Note that I refer to a golden area as a flat plane with 4 verts, and 2 tris where we can attach other golden areas together to. In our case these are somewhat purple.
Edit: the problem is that there's no real way to find out what side of a triangle is on which side.
I'll probably figure this out on my own eventually but if you have any ideas or links please let me know! (wikipedia on linear algebra makes me want to kill small adorable animals)
Editx2: I found the answer to the figuring out of what side a triangle is, via vectors and normals... in my little program, it too, fits the counter-clockwise rule that all normals have to fit under.
You can download a nice pdf that explains it very well hereNow that problem is (sorta) figured out, it was simpler than I thought tbh, I gotta figure out how much I need to rotate the limb//branch such that it lines up properly. I guess I can calculate the 2-d vector of the lines between the 2 top and bottom vertices asdfasdfjsakdfjaksdjfds ugh brain freeze.
I'll revisit this later. It's 1:30 am and I'm tired.