Class GeomModule

java.lang.Object
gaiasky.script.v2.impl.APIModule
gaiasky.script.v2.impl.GeomModule
All Implemented Interfaces:
GeomAPI

public class GeomModule extends APIModule implements GeomAPI
The geometry module provides calls and methods to carry out geometrical operations directly within the scripting system.
  • Field Summary

    Fields inherited from class gaiasky.script.v2.impl.APIModule

    api, em, logger, me, name
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new module with the given attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    cross3(double[] vec1, double[] vec2)
    Computes the cross product between the two 3D vectors.
    double[]
    cross3(List<?> vec1, List<?> vec2)
     
    double
    dot3(double[] vec1, double[] vec2)
    Computes the dot product between the two 3D vectors.
    double
    dot3(List<?> vec1, List<?> vec2)
     
    double[]
    rotate2(double[] vector, double angle)
    Rotates a 2D vector by the specified angle in degrees, counter-clockwise assuming that the Y axis points up.
    double[]
    rotate2(double[] vector, long angle)
     
    double[]
    rotate2(List<?> vector, double angle)
     
    double[]
    rotate2(List<?> vector, long angle)
     
    double[]
    rotate3(double[] vector, double[] axis, double angle)
    Rotates a 3D vector around the given axis by the specified angle in degrees.
    double[]
    rotate3(double[] vector, double[] axis, long angle)
     
    double[]
    rotate3(List<?> vector, List<?> axis, double angle)
     
    double[]
    rotate3(List<?> vector, List<?> axis, long angle)
     

    Methods inherited from class gaiasky.script.v2.impl.APIModule

    dispose

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GeomModule

      public GeomModule(EventManager em, APIv2 api, String name)
      Create a new module with the given attributes.
      Parameters:
      api - Reference to the API class.
      name - Name of the module.
  • Method Details

    • rotate3

      public double[] rotate3(double[] vector, double[] axis, double angle)
      Description copied from interface: GeomAPI
      Rotates a 3D vector around the given axis by the specified angle in degrees. Vectors are arrays with 3 components. If more components are there, they are ignored.
      Specified by:
      rotate3 in interface GeomAPI
      Parameters:
      vector - Vector to rotate, with at least 3 components.
      axis - The axis, with at least 3 components.
      angle - Angle in degrees.
      Returns:
      The new vector, rotated.
    • rotate3

      public double[] rotate3(double[] vector, double[] axis, long angle)
    • rotate3

      public double[] rotate3(List<?> vector, List<?> axis, double angle)
    • rotate3

      public double[] rotate3(List<?> vector, List<?> axis, long angle)
    • rotate2

      public double[] rotate2(double[] vector, double angle)
      Description copied from interface: GeomAPI
      Rotates a 2D vector by the specified angle in degrees, counter-clockwise assuming that the Y axis points up.
      Specified by:
      rotate2 in interface GeomAPI
      Parameters:
      vector - Vector to rotate, with at least 2 components.
      Returns:
      The new vector, rotated.
    • rotate2

      public double[] rotate2(double[] vector, long angle)
    • rotate2

      public double[] rotate2(List<?> vector, double angle)
    • rotate2

      public double[] rotate2(List<?> vector, long angle)
    • cross3

      public double[] cross3(double[] vec1, double[] vec2)
      Description copied from interface: GeomAPI
      Computes the cross product between the two 3D vectors.
      Specified by:
      cross3 in interface GeomAPI
      Parameters:
      vec1 - First 3D vector.
      vec2 - Second 3D vector.
      Returns:
      Cross product 3D vector.
    • cross3

      public double[] cross3(List<?> vec1, List<?> vec2)
    • dot3

      public double dot3(double[] vec1, double[] vec2)
      Description copied from interface: GeomAPI
      Computes the dot product between the two 3D vectors.
      Specified by:
      dot3 in interface GeomAPI
      Parameters:
      vec1 - First 3D vector.
      vec2 - Second 3D vector.
      Returns:
      The dot product scalar.
    • dot3

      public double dot3(List<?> vec1, List<?> vec2)