Class Vector3

java.lang.Object
org.graphstream.ui.geom.Vector2
org.graphstream.ui.geom.Vector3
All Implemented Interfaces:
Serializable

public class Vector3
extends Vector2
A three component vector made of doubles.
Since:
20000613
Version:
0.1
Author:
Antoine Dutot
See Also:
Serialized Form
  • Field Summary

    Fields inherited from class org.graphstream.ui.geom.Vector2

    data
  • Constructor Summary

    Constructors 
    Constructor Description
    Vector3()
    New zero vector.
    Vector3​(double x, double y, double z)
    New (x,y,z) vector.
    Vector3​(Point3 point)
    New vector copy of point.
    Vector3​(Vector3 other)
    New vector copy of other.
  • Method Summary

    Modifier and Type Method Description
    void add​(Vector3 other)
    Add each element of other to the corresponding element of this.
    Object clone()  
    void copy​(Point3 point)
    Make this a copy of point.
    void copy​(Vector3 other)
    Make this a copy of other.
    void crossProduct​(Vector3 other)
    Set this to the cross product of this and other.
    void crossProduct​(Vector3 A, Vector3 B)
    Set this to the cross product of A and B.
    double dotProduct​(double ox, double oy, double oz)  
    double dotProduct​(Vector3 other)
    Dot product of this and other.
    boolean equals​(Object other)
    Is this equal to other ?
    void fill​(double value)
    Assign value to all elements.
    boolean isZero()
    Are all components to zero?.
    double length()
    Cartesian length.
    void mult​(Vector3 other)
    Multiply each element of this by the corresponding element of other.
    double normalize()
    Transform this into an unit vector.
    void scalarAdd​(double value)
    Add value to each element.
    void scalarDiv​(double value)
    Divide each element by value.
    void scalarMult​(double value)
    Multiply each element by value.
    void scalarSub​(double value)
    Substract value to each element.
    void set​(double x, double y, double z)
    Explicitly set the three components.
    void set​(int i, double value)
    Explicitly set the i-th component to value.
    void sub​(Vector3 other)
    Substract each element of other to the corresponding element of this.
    String toString()  
    boolean validComponent​(int i)
    Is i the index of a component ?
    double z()  

    Methods inherited from class org.graphstream.ui.geom.Vector2

    add, at, copy, copy, dotProduct, dotProduct, hashCode, mult, set, sub, x, y

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Vector3

      public Vector3()
      New zero vector.
    • Vector3

      public Vector3​(double x, double y, double z)
      New (x,y,z) vector.
    • Vector3

      public Vector3​(Vector3 other)
      New vector copy of other.
    • Vector3

      public Vector3​(Point3 point)
      New vector copy of point.
  • Method Details

    • isZero

      public boolean isZero()
      Are all components to zero?.
      Overrides:
      isZero in class Vector2
    • equals

      public boolean equals​(Object other)
      Is this equal to other ?
      Overrides:
      equals in class Vector2
    • validComponent

      public boolean validComponent​(int i)
      Is i the index of a component ? In other words, is i >= 0 && < than #count() ?
      Overrides:
      validComponent in class Vector2
    • clone

      public Object clone()
      Overrides:
      clone in class Vector2
    • dotProduct

      public double dotProduct​(double ox, double oy, double oz)
    • dotProduct

      public double dotProduct​(Vector3 other)
      Dot product of this and other.
    • length

      public double length()
      Cartesian length.
      Overrides:
      length in class Vector2
    • z

      public double z()
    • fill

      public void fill​(double value)
      Assign value to all elements.
      Overrides:
      fill in class Vector2
    • set

      public void set​(int i, double value)
      Explicitly set the i-th component to value.
      Overrides:
      set in class Vector2
    • set

      public void set​(double x, double y, double z)
      Explicitly set the three components.
    • add

      public void add​(Vector3 other)
      Add each element of other to the corresponding element of this.
    • sub

      public void sub​(Vector3 other)
      Substract each element of other to the corresponding element of this.
    • mult

      public void mult​(Vector3 other)
      Multiply each element of this by the corresponding element of other.
    • scalarAdd

      public void scalarAdd​(double value)
      Add value to each element.
      Overrides:
      scalarAdd in class Vector2
    • scalarSub

      public void scalarSub​(double value)
      Substract value to each element.
      Overrides:
      scalarSub in class Vector2
    • scalarMult

      public void scalarMult​(double value)
      Multiply each element by value.
      Overrides:
      scalarMult in class Vector2
    • scalarDiv

      public void scalarDiv​(double value)
      Divide each element by value.
      Overrides:
      scalarDiv in class Vector2
    • crossProduct

      public void crossProduct​(Vector3 other)
      Set this to the cross product of this and other.
    • crossProduct

      public void crossProduct​(Vector3 A, Vector3 B)
      Set this to the cross product of A and B.
    • normalize

      public double normalize()
      Transform this into an unit vector.
      Overrides:
      normalize in class Vector2
      Returns:
      the vector length.
    • copy

      public void copy​(Vector3 other)
      Make this a copy of other.
    • copy

      public void copy​(Point3 point)
      Make this a copy of point.
    • toString

      public String toString()
      Overrides:
      toString in class Vector2