Ellipse
- class compas.geometry.Ellipse[source]
- Bases: - Conic- An ellipse is a curve defined by a coordinate system and a major and minor axis. - The centre of the ellipse is at the origin of the coordinate system. The major axis is parallel to the local x-axis. The minor axis is parallel to the local y-axis. The parameter domain of an ellipse is - [0, 2*pi]. Moving along the ellipse in the parameter direction corresponds to moving counter-clockwise around the origin of the local coordinate system.- Parameters:
- majorfloat
- The major of the ellipse. 
- minorfloat
- The minor of the ellipse. 
- framecompas.geometry.Frame, optional
- The local coordinate system of the ellipse. The default value is - None, in which case the ellipse is constructed in the XY plane of the world coordinate system.
- namestr, optional
- The name of the ellipse. 
 
- Attributes:
- framecompas.geometry.Frame
- The coordinate frame of the ellipse. 
- transformationTransformation, read-only
- The transformation from the local coordinate system of the ellipse ( - frame) to the world coordinate system.
- majorfloat
- The major of the ellipse. 
- minorfloat
- The minor of the ellipse. 
- planecompas.geometry.Plane, read-only
- The plane of the ellipse. 
- areafloat, read-only
- The area of the ellipse. 
- circumferencefloat, read-only
- The length of the circumference of the ellipse. 
- semifocalfloat, read-only
- The semi-focal distance of the ellipse. This is the distance from the center of the ellipse to the focus points. 
- focalfloat, read-only
- The distance between the two focus points. 
- eccentricityfloat, read-only
- The eccentricity of the ellipse. This is the ratio between the semifocal length to the length of the semi-major axis. 
- focus1compas.geometry.Point, read-only
- The first focus point of the ellipse. 
- focus2compas.geometry.Point, read-only
- The second focus point of the ellipse. 
- directix1compas.geometry.Line, read-only
- The first directix of the ellipse. The directix is perpendicular to the major axis and passes through a point at a distance - major **2 / semifocalalong the positive xaxis from the center of the ellipse.
- directix2compas.geometry.Line, read-only
- The second directix of the ellipse. The directix is perpendicular to the major axis and passes through a point at a distance - major **2 / semifocalalong the negative xaxis from the center of the ellipse.
- is_closedbool, read-only
- True. 
- is_periodicbool, read-only
- True. 
- is_circlebool, read-only
- True if the ellipse is a circle. 
 
- frame
 - Examples - Construct an ellipse in the world XY plane. - >>> from compas.geometry import Frame, Ellipse >>> ellipse = Ellipse(major=3, minor=2, frame=Frame.worldXY()) >>> ellipse = Ellipse(major=3, minor=2) - Construct an ellipse such that its normal aligns with a given line. - >>> from compas.geometry import Line, Frame, Plane, Ellipse >>> line = Line([0, 0, 0], [1, 1, 1]) >>> plane = Plane(line.end, line.direction) >>> ellipse = Ellipse.from_plane_major_minor(plane, 3, 2) >>> ellipse = Ellipse(major=3, minor=2, frame=Frame.from_plane(plane)) - Visualise the line, ellipse, and frame of the ellipse with the COMPAS viewer. - >>> from compas_viewer import Viewer >>> viewer = Viewer() >>> viewer.scene.add(line) >>> viewer.scene.add(ellipse) >>> viewer.scene.add(ellipse.frame) >>> viewer.show() - Methods - Construct a ellipse from a point and major and minor axis lengths. - Construct a ellipse from a point and major and minor axis lengths. - Compute the normal at a specific parameter. - Compute the point at a specific parameter. - Compute the tangent at a specific 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. - Construct a parametric curve from a native curve geometry. - 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.