Hi guys, I’m currently working on a script that reconstructs obj objects using wedges. I’ve managed to get the main part of the script working where I draw the triangles using the obj data but have run into a frustrating problem. Since the wedges are 3 dimensional, a gap occurs where the different triangles connect.
I’ve tried to inset the triangles down their local x axis but in every triangle, 1 of the two wedges has its local axes flipped and I can’t figure out how to determine which of the two wedges has had its axes flipped.
And you’ve lost float precision accuracy at this point. It doesn’t seem likely you can get around these exceptionally tiny gaps because you cannot get part sizes to go below 0.05.
Otherwise, your parts do have intersection points at the middle - which they should - if they could be smaller there would be no gap.
I believe the problem occurs at all sizes. Also, not trying to scale up or down the wedges to meet but instead trying to move them down their local z axis (x in the case of wedges) by half of the thickness of the wedge so that the upper most edges meet.
Would you mind if you could explain your solution a bit more, because I’ve been stumped on this for a few hours now and can’t believe its that simple… ;_;
When you create a matrix and - in the case of wedges - the X axis is what we’re concerned about, the right variable (the X axis of the matrix rotation) is what faces up or down.
So, we must determine if we should adjust the wedge by 0.025 (half of 0.05) by subtracting or adding it.
The dot product returns a percentage (0-1 or negative 0-1) based on how parallel a vector is to the argument.
So 0,1,0 and 0,0,0 it would return “0”. 0,1,0 and 0,1,0 would return “1”
0,1,0 and 0,-1,0 would return “-1” and anything in between would be some float value.
In short, I use the dot product to determine if right is facing towards 0,1,0 or more towards 0,-1,0.