Constraint
- class compas_fd.constraints.Constraint
Bases:
Data
Base class for all constraints.
- Parameters:
- geometry
compas.geometry.Geometry
The geometry of the constraint.
- namestr, optional
The name of the constraint.
- geometry
- Attributes:
- geometry
compas.geometry.Geometry
The geometry of the constraint.
- location
compas.geometry.Point
The location of the constrained vertex.
- residual
compas.geometry.Vector
The residual vector at the constrained vertex.
- tangent
compas.geometry.Vector
The tangent vector of the residual at the constrained vertex.
- normal
compas.geometry.Vector
The normal vector of the residual at the constrained vertex.
- paramfloat
The parameter of the closest point on the constraint geometry to the location of the constrained vertex.
- geometry
Notes
The constraint class using a registration mechanism to determine the type of constraint object for a given constraint geometry. Therefore, this class is the main entry point for creating constraints.
Examples
>>> from compas.geometry import Line >>> from compas_fd.constraints import Constraint >>> line = Line([0, 0, 0], [1, 0, 0]) >>> constraint = Constraint(line) >>> constraint LineConstraint(Line(Point(x=0.0, y=0.0, z=0.0), Point(x=1.0, y=0.0, z=0.0)), name=None)
Methods
Inherited Methods
Converts the instance to a string.
Make an independent copy of the data object.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
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.
Validate the data against the object's data schema.