Module voltrace.geometric_object

The geometric object module defines the GeometricObject abstract base class, which provides move, rotate, and mirror operations to any geometry that implements map_points. All mesh and field classes inherit from it.

Classes

class GeometricObject

The Mesh class (and the classes defined in voltrace.geometry) are subclasses of GeometricObject. This means that they all can be moved, rotated, mirrored.

Ancestors

  • abc.ABC

Subclasses

Methods

def map_points(self, fun)

Create a new geometric object, by mapping each point by a function.

Parameters

fun : (3,) float -> (3,) float
Function taking a three dimensional point and returning a three dimensional point.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.

def mirror_xy(self)

Mirror object in the XY plane.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.

def mirror_xz(self)

Mirror object in the XZ plane.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.

def mirror_yz(self)

Mirror object in the YZ plane.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.

def move(self, dx=0.0, dy=0.0, dz=0.0)

Move along x, y or z axis.

Parameters

dx : float
Amount to move along the x-axis.
dy : float
Amount to move along the y-axis.
dz : float
Amount to move along the z-axis.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.

def rotate(self, Rx=0.0, Ry=0.0, Rz=0.0, origin=(0, 0, 0))

Rotate counterclockwise around the x, y or z axis. Only one axis supported at the same time (rotations do not commute).

Parameters

Rx : float
Amount to rotate around the x-axis (radians).
Ry : float
Amount to rotate around the y-axis (radians).
Rz : float
Amount to rotate around the z-axis (radians).
origin : (3,) float
Point around which to rotate, which is the origin by default.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.

def rotate_around_axis(self, axis=(0, 0, 1), angle=0.0, origin=(0, 0, 0))

Rotate counterclockwise around a general axis defined by a vector.

Parameters

axis : (3,) float
Vector defining the axis of rotation. Must be non-zero.
angle : float
Amount to rotate around the axis (radians).
origin : (3,) float
Point around which to rotate, which is the origin by default.

Returns

GeometricObject
 

This function returns the same type as the object on which this method was called.