Method: RADMesh::STL#mirror!

Defined in:
lib/radmesh/stl.rb

#mirror!(*args) ⇒ STL

Note:

There is also the same method without ! working as expected. It is not in this reference guide, because it is automatically generated.

Mirror the mesh about the specified plane.

Mirroring involves reversing the sign of all of the coordinates in a particular axis. For example, to mirror a mesh about the XY plane, the signs of all of the Z coordinates in the mesh are reversed.

Parameters:

  • args (Array<Symbol>)

    array with 2 axis symbols

  • args (Symbol, Symbol)

    2 axis symbols (such as :z and :x)

Returns:

  • (STL)

    returns itself

Raises:

  • (ArgumentError)

    when the plane is invalid or the arguments could not be parsed

[View source]

519
520
521
522
523
524
525
526
527
528
529
# File 'lib/radmesh/stl.rb', line 519

def mirror!(*args)
  args = args[0] if args.size == 1
  raise ArgumentError,
        "wrong number of arguments (#{args.size} for 2)" if args.size != 2
  args.sort!
  begin
    send("mirror_#{args[0]}#{args[1]}!")
  rescue
    raise ArgumentError, "invalid axis pair #{args[0]}#{args[1]}"
  end
end