Parabola
- class compas.geometry.Parabola[source]
Bases:
Conic
A parabola is defined by a plane and a major and minor axis. The origin of the coordinate frame is the center of the parabola.
The parabola in this implementation is based on the equation
y = a * x**2
. Therefore it will have the y axis of the coordinate frame as its axis of symmetry.- Parameters:
- focalfloat
The focal length of the parabola.
- frame
compas.geometry.Frame
The coordinate frame of the parabola.
- namestr, optional
The name of the parabola.
Examples
Construct a parabola in the world XY plane.
>>> from compas.geometry import Frame, Parabola >>> parabola = Parabola(focal=3, frame=Frame.worldXY()) >>> parabola = Parabola(focal=3)
Construct a parabola such that the Z axis of its frame aligns with a given line.
>>> from compas.geometry import Frame, Line, Parabola >>> line = Line([0, 0, 0], [1, 1, 1]) >>> plane = Plane(line.end, line.direction) >>> frame = Frame.from_plane(plane) >>> parabola = Parabola(focal=3, frame=frame)
Visualize the parabola with the COMPAS viewer.
>>> from compas_viewer import Viewer >>> viewer = Viewer() >>> viewer.scene.add(line) >>> viewer.scene.add(parabola) >>> viewer.scene.add(parabola.frame) >>> viewer.show()
- Attributes:
- frame
compas.geometry.Frame
The coordinate frame of the parabola.
- transformation
Transformation
, read-only The transformation from the local coordinate system of the parabola (
frame
) to the world coordinate system.- focalfloat
The focal length of the parabola.
- plane
compas.geometry.Plane
, read-only The plane of the parabola.
- latus
compas.geometry.Point
, read-only The latus rectum of the parabola.
- eccentricityfloat, read-only
The eccentricity of a parabola is between 0 and 1.
- focus
compas.geometry.Point
, read-only The focus point of the parabola.
- directix
compas.geometry.Line
, read-only The directix is the line perpendicular to the y axis of the parabola frame at a distance
d = + major / eccentricity
from the origin of the parabola frame.- is_closedbool, read-only
False.
- is_periodicbool, read-only
False.
- frame
Methods
Normal at a specific normalized parameter.
Point at the parameter.
Tangent vector at the parameter.
Inherited Methods
Converts the instance to a string.
Compute the axis-aligned bounding box of the curve.
Compute the closest point on the curve to a given point.
Compute the axis-aligned bounding box of the geometry.
Compute the oriented bounding box of the geometry.
Make an independent copy of the data object.
Compute the curvature vector of the curve at a parameter.
Compute the curve parameters that divide the curve into a specific number of equal length segments.
Compute the curve parameters that divide the curve into segments of specified length.
Compute the local frame of the curve at a parameter.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Load a curve from an OBJ file.
Load a curve from a STP file.
Compute the length of the curve.
Reverse the parametrisation of the curve.
Reverse a copy of the curve.
Rotate the geometry.
Returns a rotated copy of this geometry.
Scale the geometry.
Returns a scaled copy of this geometry.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Write the curve geometry to an OBJ file.
Convert the curve to a list of points.
Convert the curve to a polygon.
Convert the curve to a polyline.
Write the curve geometry to a STP file.
Transform the local coordinate system of the curve.
Returns a transformed copy of this geometry.
Translate the geometry.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.