point_3d
point_3d
__add__(other: point_3d) -> point_3d
Add two points component-wise.
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The sum of two points. |
__eq__(other: object) -> bool
Check if two points are equal.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if equal, False otherwise. |
__getitem__(index: int) -> float
Get coordinate by index (0: x, 1: y, 2: z).
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The coordinate value. |
Raises: IndexError: If index is out of range.
__iadd__(other: point_3d) -> point_3d
In-place addition of another point.
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The updated point. |
__imul__(other: float) -> point_3d
In-place multiplication by a scalar.
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The updated point. |
__init__(x: float, y: float, z: float)
Initialize an instance of a point_3d.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The x-coordinate of the point. |
required |
y
|
float
|
The y-coordinate of the point. |
required |
z
|
float
|
The z-coordinate of the point. |
required |
__isub__(other: point_3d) -> point_3d
In-place subtraction of another point.
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The updated point. |
__itruediv__(other: float) -> point_3d
__mul__(other: float) -> point_3d
__ne__(other: object) -> bool
Check if two points are not equal.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if not equal, False otherwise. |
__neg__() -> point_3d
Negate the point (component-wise).
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The negated point. |
__repr__() -> str
Return the string representation of the point.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The string representation. |
__rmul__(other: float) -> point_3d
Multiply point by a scalar (right-hand side).
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The scaled point. |
__setitem__(index: int, value: float) -> None
Set coordinate by index (0: x, 1: y, 2: z).
Raises:
| Type | Description |
|---|---|
IndexError
|
If index is out of range. |
__sub__(other: point_3d) -> point_3d
Subtract two points component-wise.
Returns:
| Name | Type | Description |
|---|---|---|
point_3d |
point_3d
|
The difference of two points. |
__truediv__(other: float) -> point_3d
cross(p: point_3d) -> point_3d
Cross product with another point.
distance(p: point_3d) -> float
Euclidean distance to another point.
dot(p: point_3d) -> float
Dot product with another point.
invert() -> point_3d
Return the inverted point (negated coordinates).
magnitude() -> float
Return the magnitude of the point vector.
normalized() -> point_3d
Return the normalized (unit) vector.