Point
- class Point
Bases:
BaseModel
Represents a point in 3D space, defined by its x, y, and z coordinates.
- x
The x-coordinate of the point.
- Type:
float
- y
The y-coordinate of the point.
- Type:
float
- z
The z-coordinate of the point.
- Type:
float
- Raises:
ValueError – If any coordinate is not a finite number, ensuring points are well-defined in 3D space.
Attributes Summary
Return the coordinates as a tuple (x, y, z).
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Summary
distance_to
(other)Calculate the Euclidean distance between this point and another point.
validate_coordinate
(value)Validate that the coordinate is a finite number, ensuring the point is well-defined.
Attributes Documentation
- coordinates
Return the coordinates as a tuple (x, y, z).
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Documentation
- distance_to(other)
Calculate the Euclidean distance between this point and another point.
- Parameters:
other (Point) – The other point to calculate the distance to.
- Returns:
The Euclidean distance between the two points.
- Return type:
float
- classmethod validate_coordinate(value)
Validate that the coordinate is a finite number, ensuring the point is well-defined.
- Parameters:
value (float) – The coordinate value to validate.
- Returns:
The validated coordinate value.
- Raises:
ValueError – If the coordinate is not a finite number.
- Return type:
float
Attributes:
Return the coordinates as a tuple (x, y, z).
__setattr__ handlers.
Methods:
validate_coordinate
(value)Validate that the coordinate is a finite number, ensuring the point is well-defined.
distance_to
(other)Calculate the Euclidean distance between this point and another point.
__hash__
()Return the hash value of the Point object.
- property coordinates: Tuple[float, float, float]
Return the coordinates as a tuple (x, y, z).
- classmethod validate_coordinate(value)
Validate that the coordinate is a finite number, ensuring the point is well-defined.
- Parameters:
value (float) – The coordinate value to validate.
- Returns:
The validated coordinate value.
- Raises:
ValueError – If the coordinate is not a finite number.
- Return type:
float
- distance_to(other)
Calculate the Euclidean distance between this point and another point.
- Parameters:
other (Point) – The other point to calculate the distance to.
- Returns:
The Euclidean distance between the two points.
- Return type:
float
- __hash__()
Return the hash value of the Point object.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__