Tolerance
- class compas.tolerance.Tolerance[source]
Bases:
Data
Tolerance settings for geometric operations.
- Parameters:
- unit{“M”, “MM”}, optional
The unit of the tolerance settings.
- namestr, optional
The name of the tolerance settings.
Notes
The absolute tolerance is used to determine when a number is small enough to be considered zero. The relative tolerance determines the allowable deviation between two values for the values to be considered equal. The relative tolerance is defined as a fraction of one of the two values. This value is called the “true value”. By convention, the second value is considered the “true value” by the comparison functions of this class.
Examples
>>> tol = Tolerance() >>> tol.unit 'M' >>> tol.absolute 1e-09 >>> tol.relative 1e-06 >>> tol.angular 1e-06
- Attributes:
- unit{“M”, “MM”}
The unit of the tolerance settings.
- absolutefloat
The absolute tolerance.
- relativefloat
The relative tolerance.
- angularfloat
The angular tolerance.
- approximationfloat
The tolerance used in approximation processes.
- precisionint
The precision used when converting numbers to strings. Positive numbers correspond to the number of digits after the decimal point. Negative numbers correspond to the number of digits before the decimal point. Zero corresponds to integer precision. Therefore, the higher the number the higher the precision.
- lineardeflectionfloat
The maximum distance between a curve or surface and its polygonal approximation.
Methods
Compare two values.
Format a number as a string.
Compute the geometric key of a point.
Check if two lists of values are element-wise close enough to be considered equal.
Check if an angle is close enough to zero to be considered zero.
Check if two angles are close enough to be considered equal.
Check if a value is between two other values.
Check if two values are close enough to be considered equal.
Check if a value can be considered a strictly negative number.
Check if a value can be considered a strictly positive number.
Check if a value is close enough to zero to be considered zero.
Compute the precision from a given tolerance.
Reset all precision settings to their default values.
Compute the tolerance for a comparison.
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.