Frame

class compas.geometry.Frame[source]

Bases: Geometry

A frame is defined by a base point and two orthonormal base vectors.

Parameters:
point[float, float, float] | compas.geometry.Point

The origin of the frame.

xaxis[float, float, float] | compas.geometry.Vector, optional

The x-axis of the frame. Defaults to the unit X vector.

yaxis[float, float, float] | compas.geometry.Vector, optional

The y-axis of the frame. Defaults to the unit Y vector.

namestr, optional

The name of the frame.

Attributes:
axeslist of compas.geometry.Vector, read-only

The XYZ axes of the frame.

axis_angle_vectorcompas.geometry.Vector, read-only

The axis-angle vector representing the rotation of the frame.

normalcompas.geometry.Vector, read-only

The normal of the base plane of the frame.

pointcompas.geometry.Point

The base point of the frame.

quaternioncompas.geometry.Quaternion, read-only

The quaternion from the rotation given by the frame.

xaxiscompas.geometry.Vector

The local X axis of the frame.

yaxiscompas.geometry.Vector

The local Y axis of the frame.

zaxiscompas.geometry.Vector, read-only

The Z axis of the frame.

Notes

All input vectors are orthonormalized when creating a frame, with the first vector as starting point.

Examples

>>> from compas.geometry import Point
>>> from compas.geometry import Vector
>>> f = Frame([0, 0, 0], [1, 0, 0], [0, 1, 0])
>>> f = Frame(Point(0, 0, 0), Vector(1, 0, 0), Vector(0, 1, 0))
>>> f = Frame([0, 0, 0])

Methods

axes

euler_angles

The Euler angles from the rotation given by the frame.

from_axis_angle_vector

Construct a frame from an axis-angle vector representing the rotation.

from_euler_angles

Construct a frame from a rotation represented by Euler angles.

from_list

Construct a frame from a list of 12 or 16 float values.

from_matrix

Construct a frame from a matrix.

from_plane

Constructs a frame from a plane.

from_points

Constructs a frame from 3 points.

from_quaternion

Construct a frame from a rotation represented by quaternion coefficients.

from_rotation

Constructs a frame from a Rotation.

from_transformation

Constructs a frame from a Transformation.

interpolate_frame

Interpolates between two frames at a given parameter t in the range [0, 1]

interpolate_frames

Generates a specified number of interpolated frames between two given frames

to_local_coordinates

Returns the object's coordinates in the local coordinate system of the frame.

to_transformation

Convert the frame to a transformation.

to_world_coordinates

Returns the object's coordinates in the global coordinate frame.

transform

Transform the frame.

worldXY

Construct the world XY frame.

worldYZ

Construct the world YZ frame.

worldZX

Construct the world ZX frame.

Inherited Methods

ToString

Converts the instance to a string.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

rotate

Rotate the geometry.

rotated

Returns a rotated copy of this geometry.

scale

Scale the geometry.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

validate_data

Validate the data against the object's data schema.