======================== Vector (hwx.common.math) ======================== A mathematical represenation of a Vector in 3D space. ---------- Properties ---------- +----+----+----+ | x_ | y_ | z_ | +----+----+----+ -------------- Public Methods -------------- +---------------------------------------------------------------------------+ | classmethod findAngle_ (cls, pt1, pt2, pt3, degrees=False) | +---------------------------------------------------------------------------+ | angle_ (self, x, y=None, z=None, degrees=False) | +---------------------------------------------------------------------------+ | close_ (self, x, y=None, z=None, tol=1e-07) | +---------------------------------------------------------------------------+ | copy_ (self, x=None, y=None, z=None) | +---------------------------------------------------------------------------+ | cross_ (self, x, y=None, z=None) | +---------------------------------------------------------------------------+ | dot_ (self, x, y=None, z=None) | +---------------------------------------------------------------------------+ | isAlignedWith_ (self, x, y=None, z=None, tolerance=1e-05, normalize=True) | +---------------------------------------------------------------------------+ | iszero_ (self) | +---------------------------------------------------------------------------+ | magnitude_ (self) | +---------------------------------------------------------------------------+ | normalize_ (self) | +---------------------------------------------------------------------------+ | perpendicularize_ (self) | +---------------------------------------------------------------------------+ | scale_ (self, x, y=None, z=None) | +---------------------------------------------------------------------------+ ---------------- Property Details ---------------- .. _x: .. method:: x The x coordinate. .. _y: .. method:: y The y coordinate. .. _z: .. method:: z The z coordinate. -------------- Method Details -------------- .. _findAngle: .. classmethod:: findAngle(cls, pt1, pt2, pt3, degrees=False) Computes the angle subtended between (pt2-pt1) and (pt3-pt1). :param pt1: The first Vector. :type pt1: Vector :param pt2: The second Vector. :type pt2: Vector :param pt3: The third Vector. :type pt3: Vector :param degrees: Determines if the return value will be in degrees or not. :type degrees: bool :returns: The angle. :rtype: float .. _angle: .. method:: angle(self, x, y=None, z=None, degrees=False) Computes the angle with the Vector defined by x, y, z. :param x: The x coordinate. :type x: float :param y: The y coordinate. :type y: float :param z: The z coordinate. :type z: float :param degrees: Determines if the return value will be in degrees or not. :type degrees: bool :returns: The angle. :rtype: float .. _close: .. method:: close(self, x, y=None, z=None, tol=1e-07) Determines if the distance to the Vector defined by x, y, z is less or equal than tolerance. :param x: The x coordinate. :type x: float :param y: The y coordinate. :type y: float :param z: The z coordinate. :type z: float :param tolerance: The tolerance to consider when checking condition. :type tolerance: float :returns: True if Vectors are close, False otherwise. :rtype: bool .. _copy: .. method:: copy(self, x=None, y=None, z=None) Creates a copy of self. If x, y, z are given then the copy has these as coordinates. :param x: The x coordinate. :type x: float :param y: The y coordinate. :type y: float :param z: The z coordinate. :type z: float :returns: The newly created object. :rtype: Vector .. _cross: .. method:: cross(self, x, y=None, z=None) Computes the cross product with the Vector defined by x, y, z. :param x: The x coordinate. :type x: float :param y: The y coordinate. :type y: float :param z: The z coordinate. :type z: float :returns: The cross product. :rtype: Vector .. _dot: .. method:: dot(self, x, y=None, z=None) Computes the dot product with the Vector defined by x, y, z. :param x: The x coordinate. :type x: float :param y: The y coordinate. :type y: float :param z: The z coordinate. :type z: float :returns: The dot product. :rtype: float .. _isAlignedWith: .. method:: isAlignedWith(self, x, y=None, z=None, tolerance=1e-05, normalize=True) Determines if self is parallel to the Vector defined by x, y, z. :param x: The x coordinate. :type x: float :param y: The y coordinate. :type y: float :param z: The z coordinate. :type z: float :param tolerance: The tolerance to consider when checking condition. :type tolerance: float :param normalize: Determines whether to normalize self before checking the condition. :type normalize: bool :returns: True if Vectors are aligned, False otherwise. :rtype: bool .. _iszero: .. method:: iszero(self) Returns True if x, y and z are set to zero, False otherwise. .. _magnitude: .. method:: magnitude(self) Returns the magnitude. .. _normalize: .. method:: normalize(self) Returns the normalized Vector. .. _perpendicularize: .. method:: perpendicularize(self) Computes a Vector perpendicular to self. If any of the coordinates are zero, returns a Vector along that coordinate, otherwise returns the cross product with (1, 0, 0). .. _scale: .. method:: scale(self, x, y=None, z=None) Scales by a single value 'x' or a tripple (x, y, z), elementwise. :param x: The x scale factor. :type x: float :param y: The y scale factor. :type y: float :param z: The z scale factor. :type z: float :returns: The scaled Vector. :rtype: Vector