How to flip normals of Graphics3d faces?

asked 2022-04-10 23:53:00 +0200

Dan-K gravatar image

updated 2022-04-11 07:02:35 +0200

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 but couldn't find any answers there.


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(
        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 axis

    mirroredSurface = mySurface.rotateY(pi)
  • Scaling by -1 in 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.


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?

# or
edit retag flag offensive close merge delete


This could be considered as a bug in TransformGroup. You are welcome to help fix the bug by diving into sage code.

FrédéricC gravatar imageFrédéricC ( 2022-04-11 11:10:05 +0200 )edit