Class Vector3D

All Implemented Interfaces:
Vector<Real>, AbelianGroup<Vector<Real>>, AbelianMonoid<Vector<Real>>, Group<Vector<Real>>, Magma<Vector<Real>>, Monoid<Vector<Real>>, Set<Vector<Real>>, Module<Vector<Real>, Real>, MetricSpace<Vector<Real>>, TopologicalSpace<Vector<Real>>

public class Vector3D extends DenseVector<Real> implements MetricSpace<Vector<Real>>
Represents a 3D vector.

providing convenient constructors and accessors.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Field Details

    • ZERO

      public static final Vector3D ZERO
    • X_AXIS

      public static final Vector3D X_AXIS
    • Y_AXIS

      public static final Vector3D Y_AXIS
    • Z_AXIS

      public static final Vector3D Z_AXIS
  • Constructor Details

    • Vector3D

      public Vector3D(double x, double y, double z)
      Creates a new Vector3D from double coordinates.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
    • Vector3D

      public Vector3D(Real x, Real y, Real z)
      Creates a new Vector3D from Real coordinates.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
  • Method Details

    • x

      public Real x()
    • y

      public Real y()
    • z

      public Real z()
    • cross

      public Vector3D cross(Vector3D other)
      Returns the cross product of this vector and another. Overridden to return Vector3D type.
    • getX

      public double getX()
    • getY

      public double getY()
    • getZ

      public double getZ()
    • normalize

      public Vector3D normalize()
      Description copied from interface: Vector
      Returns the normalized vector (unit vector).
      Specified by:
      normalize in interface Vector<Real>
      Overrides:
      normalize in class GenericVector<Real>
      Returns:
      this / norm()
    • magnitude

      public Real magnitude()
    • norm

      public Real norm()
      Description copied from interface: Vector
      Returns the norm (length) of this vector.
      Specified by:
      norm in interface Vector<Real>
      Overrides:
      norm in class GenericVector<Real>
      Returns:
      the norm of this vector
    • multiply

      public Vector3D multiply(Real scalar)
      Description copied from interface: Vector
      Returns the scalar product of this vector.
      Specified by:
      multiply in interface Vector<Real>
      Overrides:
      multiply in class GenericVector<Real>
      Parameters:
      scalar - the scalar multiplier
      Returns:
      this * scalar
    • divide

      public Vector3D divide(Real scalar)
    • negate

      public Vector3D negate()
      Description copied from interface: Vector
      Returns the negation of this vector (-this).
      Specified by:
      negate in interface Vector<Real>
      Overrides:
      negate in class GenericVector<Real>
      Returns:
      -this
    • distance

      public Real distance(Vector<Real> a, Vector<Real> b)
      Description copied from interface: MetricSpace
      Computes the distance between two points.
      Specified by:
      distance in interface MetricSpace<Vector<Real>>
      Parameters:
      a - the first point
      b - the second point
      Returns:
      the distance between a and b
    • containsPoint

      public boolean containsPoint(Vector<Real> p)
      Description copied from interface: TopologicalSpace
      Checks if this space contains the given point.

      Named containsPoint to avoid erasure conflict with Set.contains.

      Specified by:
      containsPoint in interface TopologicalSpace<Vector<Real>>
      Parameters:
      p - the point to check
      Returns:
      true if the point is in this space
    • contains

      public boolean contains(Vector<Real> p)
      Description copied from interface: Set
      Tests whether this set contains the specified element.

      This is the fundamental operation of a set - membership testing.

      Specified by:
      contains in interface Set<Vector<Real>>
      Overrides:
      contains in class GenericVector<Real>
      Parameters:
      p - the element to test for membership
      Returns:
      true if this set contains the element, false otherwise
      See Also:
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Set
      Returns true if this set contains no elements.

      The empty set (∅) is a fundamental concept in set theory. It is the unique set containing no elements.

      Specified by:
      isEmpty in interface Set<Vector<Real>>
      Overrides:
      isEmpty in class GenericVector<Real>
      Returns:
      true if this set is empty
    • isOpen

      public boolean isOpen()
      Description copied from interface: TopologicalSpace
      Checks if this set is open in the topology.
      Specified by:
      isOpen in interface TopologicalSpace<Vector<Real>>
      Returns:
      true if this is an open set
    • isClosed

      public boolean isClosed()
      Description copied from interface: TopologicalSpace
      Checks if this set is closed in the topology.
      Specified by:
      isClosed in interface TopologicalSpace<Vector<Real>>
      Returns:
      true if this is a closed set
    • dot

      public Real dot(Vector3D other)
    • subtract

      public Vector3D subtract(Vector3D other)
    • add

      public Vector3D add(Vector3D other)