anastruct.vertex ================ .. py:module:: anastruct.vertex Classes ------- .. autoapisummary:: anastruct.vertex.Vertex Functions --------- .. autoapisummary:: anastruct.vertex.vertex_range anastruct.vertex.det_coordinates Module Contents --------------- .. py:class:: Vertex(x: Union[anastruct._types.VertexLike, anastruct._types.NumberLike], y: Union[anastruct._types.NumberLike, None] = None) Utility point in 2D. .. py:property:: x :type: float X coordinate Returns: float: X coordinate .. py:property:: y :type: float Y coordinate Returns: float: Y coordinate .. py:property:: y_neg :type: float Y negative coordinate (equals negative of Y coordinate) Returns: float: Y_neg coordinate .. py:method:: modulus() -> float Magnitude of the vector from the origin to the Vertex Returns: float: Magnitude of the vector from the origin to the Vertex .. py:method:: unit() -> Vertex Unit vector from the origin to the Vertex Returns: Vertex: Unit vector from the origin to the Vertex .. py:method:: displace_polar(alpha: float, radius: float, inverse_y_axis: bool = False) -> None Displace the Vertex by a polar coordinate Args: alpha (float): Angle in radians radius (float): Radius inverse_y_axis (bool, optional): Return a negative Y coordinate. Defaults to False. .. py:method:: __add__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Add two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to add Returns: Vertex: Sum of the two Vertex objects .. py:method:: __radd__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Add two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to add Returns: Vertex: Sum of the two Vertex objects .. py:method:: __sub__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Subtract two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to subtract Returns: Vertex: Difference of the two Vertex objects .. py:method:: __rsub__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Subtract two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to subtract Returns: Vertex: Difference of the two Vertex objects .. py:method:: __mul__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Multiply two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to multiply Returns: Vertex: Product of the two Vertex objects .. py:method:: __rmul__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Multiply two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to multiply Returns: Vertex: Product of the two Vertex objects .. py:method:: __truediv__(other: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> Vertex Divide two Vertex objects Args: other (Union[VertexLike, NumberLike]): Vertex to divide Returns: Vertex: Quotient of the two Vertex objects .. py:method:: __eq__(other: object) -> bool Check if two Vertex objects are equal Args: other (object): Object to compare Raises: NotImplementedError: If the object is not a Vertex object or a tuple or list of length 2 Returns: bool: True if the two Vertex objects are equal .. py:method:: __str__() -> str String representation of the Vertex object Returns: str: String representation of the Vertex object .. py:method:: __hash__() -> int Hash of the Vertex object Returns: int: Hash of the Vertex object .. py:function:: vertex_range(v1: Vertex, v2: Vertex, n: int) -> list Create a list of n Vertex objects between two Vertex objects Args: v1 (Vertex): Starting Vertex v2 (Vertex): Ending Vertex n (int): Number of Vertex objects to create Returns: list: List of n Vertex objects between v1 and v2 .. py:function:: det_coordinates(point: Union[anastruct._types.VertexLike, anastruct._types.NumberLike]) -> numpy.ndarray Convert a point to coordinates Args: point (Union[VertexLike, NumberLike]): Point to convert Raises: TypeError: If the point is not convertable to a Vertex object Returns: np.ndarray: Coordinates of the point