Spline
- class Spline
Bases:
BaseModel
Represents a spline, which is a smooth curve constructed from a series of control points.
Splines are essential in various applications such as computer graphics, geometric modeling, and trajectory planning.
- points
The list of control points that define the spline. The spline passes through these points.
- Type:
List[Point]
- degree
The degree of the spline curve. Common values are 2 (quadratic) and 3 (cubic).
- Type:
int
- Raises:
ValueError – If the number of points is less than the degree + 1, which is necessary for defining a valid spline.
Attributes Summary
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Summary
validate_degree
(value)Validate that the degree of the spline is a positive integer.
validate_points
(value, values)Validate that the list of points is sufficient to define a spline of the specified degree.
Attributes Documentation
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Documentation
- classmethod validate_degree(value)
Validate that the degree of the spline is a positive integer.
- Parameters:
value (int) – The degree of the spline.
- Returns:
The validated degree of the spline.
- Raises:
ValueError – If the degree is not a positive integer.
- Return type:
int
- classmethod validate_points(value, values)
Validate that the list of points is sufficient to define a spline of the specified degree.
- Parameters:
value (List[Point]) – The list of control points.
values (dict) – A dictionary of field names to their validated values.
- Returns:
The validated list of control points.
- Raises:
ValueError – If the number of points is less than the required for the spline’s degree.
- Return type:
List[Point]
Methods:
validate_points
(value, values)Validate that the list of points is sufficient to define a spline of the specified degree.
validate_degree
(value)Validate that the degree of the spline is a positive integer.
Attributes:
__setattr__ handlers.
- classmethod validate_points(value, values)
Validate that the list of points is sufficient to define a spline of the specified degree.
- Parameters:
value (List[Point]) – The list of control points.
values (dict) – A dictionary of field names to their validated values.
- Returns:
The validated list of control points.
- Raises:
ValueError – If the number of points is less than the required for the spline’s degree.
- Return type:
List[Point]
- classmethod validate_degree(value)
Validate that the degree of the spline is a positive integer.
- Parameters:
value (int) – The degree of the spline.
- Returns:
The validated degree of the spline.
- Raises:
ValueError – If the degree is not a positive integer.
- Return type:
int
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__