public class

VectorUtils

extends Object
java.lang.Object
   ↳ com.commsignia.v2x.utils.vectors.VectorUtils

Class Overview

Useful utilities for handling vectors

Summary

Public Methods
static Vector2D headingVector(double degrees)
Calculate heading vector based on degrees
static Point2D intersectionPoint(Point2D ps1, Point2D pe1, Point2D ps2, Point2D pe2)
Calculate the intersection point of two lines.
static Point2D intersectionPoint(Point2D firstVehicle, double firstVehicleHeading, Point2D secondVehicle, double secondVehicleHeading)
Determine if two vehicles might have an intersection point based on their point in space and their heading
static Point2D intersectionPoint(Point2D firstVehicle, Vector2D firstVehicleDirection, Point2D secondVehicle, Vector2D secondVehicleDirection)
Determine the intersection point of two vehicles based on their point in space and heading vector
static boolean isInsideHalfPlane(Point2D p0, Vector2D dir, Point2D p)
Determines if p point is inside the half plane denoted by point p0 and direction.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Vector2D headingVector (double degrees)

Calculate heading vector based on degrees

Parameters
degrees heading degree
Returns
  • vector representing the heading

public static Point2D intersectionPoint (Point2D ps1, Point2D pe1, Point2D ps2, Point2D pe2)

Calculate the intersection point of two lines.

Parameters
ps1 The start coordinate of the first line
pe1 The end coordinate of the first line
ps2 The start coordinate of the second line
pe2 The end coordinate of the second line
Returns
  • intersection point

public static Point2D intersectionPoint (Point2D firstVehicle, double firstVehicleHeading, Point2D secondVehicle, double secondVehicleHeading)

Determine if two vehicles might have an intersection point based on their point in space and their heading

Parameters
firstVehicle location of the first vehicle
firstVehicleHeading heading of the first vehicle
secondVehicle location of the second vehicle
secondVehicleHeading heading of the second vehicle
Returns
  • intersection point

public static Point2D intersectionPoint (Point2D firstVehicle, Vector2D firstVehicleDirection, Point2D secondVehicle, Vector2D secondVehicleDirection)

Determine the intersection point of two vehicles based on their point in space and heading vector

Parameters
firstVehicle location of the first vehicle
firstVehicleDirection direction of the first vehicle as a heading vector see headingVector(double)
secondVehicle location of the second vehicle
secondVehicleDirection direction of the second vehicle as a heading vector see headingVector(double)
Returns
  • intersection point

public static boolean isInsideHalfPlane (Point2D p0, Vector2D dir, Point2D p)

Determines if p point is inside the half plane denoted by point p0 and direction.

Parameters
p0 point
dir direction
p other point
Returns
  • whether the specified point p is inside the half plane or not