How to flip normals of Graphics3d faces?
Is there an easy way to flip the normals for all the faces of a sage.plot.plot3d.base.Graphics3d or sage.plot.plot3d.base.Graphics3dGroup object?
I checked the source of https://github.com/sagemath/sage/blob... but couldn't find any answers there.
Background:
I am generating a 3-dimensional surface on the YZ plane via sage.plot.plot.parametric_plot using long-running functions and want to mirror this surface by the XY plane to produce a final mesh which includes both the original and mirrored surfaces.
mySurface = parametric_plot(
[
0,
lambda u, v: longRunningYFunction(u, v),
lambda u, v: longRunningZFunction(u, v)
],
...
)
The reason I want to mirror the original surface instead of regenerating it is because the long-running functions take a very long time to complete, so doing it this way effectively cuts down the processing time in half.
I tried a few ways to mirror the surface:
Rotating by
180°around the Y axismirroredSurface = mySurface.rotateY(pi)Scaling by
-1in the Z direction:mirroredSurface = mySurface.scale([1, 1, -1])
and when I display or write both surfaces it looks ok:
show(mySurface + mirroredSurface)
but when inspected more closely, the normals of mirroredSurface are in the opposite direction of mySurface. This requires me to manually flip the surfaces with Blender.
Question:
Is there any extension or function I can apply on the Graphics3d object mirroredSurface that would flip all the surface normals?
Something like the following?
mirroredSurface.flip_normals()
# or
flip_normals(mirroredSurface)
This could be considered as a bug in
TransformGroup. You are welcome to help fix the bug by diving into sage code.