Class Vertex

java.lang.Object
jaba.Hull.Vertex

public class Vertex extends Object
A class defining a vertex.
Version:
1.1
Author:
Chris Pudney cpudney@alphapharm.pharm.uwa.edu.au
  • Constructor Details

    • Vertex

      public Vertex()
      Construct the vertex at (0, 0, 0).
    • Vertex

      public Vertex(int x, int y, int z)
      Construct a vertex given a set of coordinates.
      Parameters:
      x - , y, z The coordinates.
  • Method Details

    • getCoords

      public int[] getCoords()
      Get the coordinates of the vertex.
      Returns:
      An array of three integers containing the coordinates (x, y, z).
    • sameVertex

      public static boolean sameVertex(Vertex v1, Vertex v2)
      Tests whether two vertices are the same point.
      Parameters:
      v1 - , v2 the vertices to compare
      Returns:
      True/false if the vertices are the same/different.
    • collinear

      public static boolean collinear(Vertex v1, Vertex v2, Vertex v3)
      Tests whether three vertices are collinear.
      Parameters:
      v1 - , v2, v3 the vertices to test
      Returns:
      True/false if the vertices are collinear/non-collinear
    • bounds

      public static Vertex[] bounds(Vertex v1, Vertex v2, Vertex v3)
      Returns the pair of vertices that bound three collinear vertices.
      Parameters:
      v1 - , v2, v3 the vertices to test
      Returns:
      An array of two vertices that bound the tested vertices
    • distanceSquared

      public static long distanceSquared(Vertex v1, Vertex v2)
      Returns the square of the distance between two vertices.
      Parameters:
      v1 - , v2 the vertices
      Returns:
      the distance squared between them
    • normSq

      public long normSq()
      Returns the square of the norm of a vector
      Returns:
      the square of the norm of this vertex
    • dotProduct

      public static long dotProduct(Vertex v1, Vertex v2)
      Returns the dot product of two vectors
      Parameters:
      v1 - , v2 the vectors
      Returns:
      v1.v2
    • vectorDiff

      public static Vertex vectorDiff(Vertex v1, Vertex v2)
      Returns the vector difference between two vertices
      Parameters:
      v1 - , v2 the vertices
      Returns:
      v1 - v2
    • crossProduct

      public static Vertex crossProduct(Vertex v1, Vertex v2)
      Returns the cross product of two vectors
      Parameters:
      v1 - , v2 the vectors
      Returns:
      v1 x v2
    • toString

      public String toString()
      Returns a string that describes a vertex.
      Overrides:
      toString in class Object