Frame

class compas.geometry.Frame(point, xaxis, yaxis)[source]

Bases: compas.geometry.primitives._primitive.Primitive

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

Parameters
  • point (point) – The origin of the frame.

  • xaxis (vector) – The x-axis of the frame.

  • yaxis (vector) – The y-axis of the frame.

Attributes

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), Point(0, 1, 0))

Methods

__init__(point, xaxis, yaxis)

Initialize self.

copy()

Makes a copy of this primitive.

euler_angles([static, axes])

The Euler angles from the rotation given by the frame.

from_axis_angle_vector(axis_angle_vector[, …])

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

from_data(data)

Construct a frame from its data representation.

from_euler_angles(euler_angles[, static, …])

Construct a frame from a rotation represented by Euler angles.

from_json(filepath)

Construct a primitive from structured data contained in a json file.

from_list(values)

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

from_matrix(matrix)

Construct a frame from a matrix.

from_plane(plane)

Constructs a frame from a plane.

from_points(point, point_xaxis, point_xyplane)

Constructs a frame from 3 points.

from_quaternion(quaternion[, point])

Construct a frame from a rotation represented by quaternion coefficients.

from_rotation(rotation[, point])

Constructs a frame from a Rotation.

from_transformation(transformation)

Constructs a frame from a Transformation.

local_to_local_coordinates(frame1, frame2, …)

Returns the object’s coordinates in frame1 in the local coordinates of frame2.

to_data()

Returns the data dictionary that represents the primitive.

to_json(filepath)

Serialise the structured data representing the primitive to json.

to_local_coordinates(object_in_wcf)

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

to_world_coordinates(object_in_lcf)

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

transform(T)

Transform the frame.

transformed(transformation)

Returns a transformed copy of this primitive.

validate_data()

Validate the data of this object against its data schema (self.DATASCHEMA).

validate_json()

Validate the data loaded from a JSON representation of the data of this object against its data schema (self.DATASCHEMA).

worldXY()

Construct the world XY frame.

worldYZ()

Construct the world YZ frame.

worldZX()

Construct the world ZX frame.