๐งต Untitled Thread
Anonymous at Thu, 25 Apr 2024 23:21:36 UTC No. 16146039
hey, so I've been making a 3d editing software. I've been stuck on face extrusion for a day or so.
when I extrude a face (move it in a given direction and connect it with new polygons) some of the new quads end up facing the wrong direction (inwards). how can I detect this mathematically?
You can do the cross product to determine the quad's normal vector, but I honestly have no clue how to tell if the normal is correct. (of course visually it's quiet obvious when it's flipped) I tried taking the angle between the normal and the extrude direction but its always at 90 degrees, (never -90) so that's a dead end. you can check if the normal facing towards the 'center' of the shape or away. but that won't work for concave shapes
Anonymous at Fri, 26 Apr 2024 00:16:17 UTC No. 16146100
>>16146039
compute normals of adjacent polys and set new polys' normals such that they have an inner product that is positive. if you interpret the new polys as a ribbon, then you only have to do the preceding calculation once for the first poly and then set the order of the points in the ribbon so that new polys have a normal consistent with the first one
Anonymous at Fri, 26 Apr 2024 00:34:59 UTC No. 16146119
>>16146039
dot product between the original face normal and the new face normals - positive, pointing in the same direction as the original
Anonymous at Fri, 26 Apr 2024 23:52:52 UTC No. 16147638
>>16146039
this is not science or math gtfo.