A* Pathfinding Project  4.3.2
The A* Pathfinding Project for Unity 3D
JobRVO.VO2 Struct Reference

Public Member Functions

 VO2 (float2 center, float2 offset, float radius, float inverseDt, float inverseDeltaTime)
 Creates a VO for avoiding another agent. More...
 
void Draw (float2 circleCenter, float2 drawingOffset)
 
float2 Gradient (float2 p, out float weight)
 Gradient and value of the cost function of this VO. More...
 
float2 ScaledGradient (float2 p, out float weight)
 Gradient and value of the cost function of this VO. More...
 

Static Public Member Functions

static float2 Normalize (float2 v, out float length)
 
static float SignedDistanceFromLine (float2 a, float2 dir, float2 p)
 Returns a negative number of if p lies on the left side of a line which with one point in a and has a tangent in the direction of dir. More...
 

Public Attributes

float4 halfPlaneOffsets
 
float2 n1
 
float2 n2
 
float2 n3
 
float2 n4
 
float weightBonus
 
float weightFactor
 

Constructor & Destructor Documentation

◆ VO2()

VO2 ( float2  center,
float2  offset,
float  radius,
float  inverseDt,
float  inverseDeltaTime 
)

Creates a VO for avoiding another agent.

Parameters
centerThe position of the other agent relative to this agent.
offsetOffset of the velocity obstacle. For example to account for the agents' relative velocities.
radiusCombined radius of the two agents (radius1 + radius2).
inverseDt1 divided by the local avoidance time horizon (e.g avoid agents that we will hit within the next 2 seconds).
inverseDeltaTime1 divided by the time step length.

Member Function Documentation

◆ Draw()

void Draw ( float2  circleCenter,
float2  drawingOffset 
)

◆ Gradient()

float2 Gradient ( float2  p,
out float  weight 
)

Gradient and value of the cost function of this VO.

The VO has a cost function which is 0 outside the VO and increases inside it as the point moves further into the VO.

This is the negative gradient of that function as well as its value (the weight). The negative gradient points in the direction where the function decreases the fastest.

The value of the function is the distance to the closest edge of the VO and the gradient is normalized.

◆ Normalize()

static float2 Normalize ( float2  v,
out float  length 
)
static

◆ ScaledGradient()

float2 ScaledGradient ( float2  p,
out float  weight 
)

Gradient and value of the cost function of this VO.

Very similar to the Gradient method however the gradient and value have been scaled and tweaked slightly.

◆ SignedDistanceFromLine()

static float SignedDistanceFromLine ( float2  a,
float2  dir,
float2  p 
)
static

Returns a negative number of if p lies on the left side of a line which with one point in a and has a tangent in the direction of dir.

The number can be seen as the double signed area of the triangle {a, a+dir, p} multiplied by the length of dir. If dir.magnitude=1 this is also the distance from p to the line {a, a+dir}.

Member Data Documentation

◆ halfPlaneOffsets

float4 halfPlaneOffsets

◆ n1

float2 n1

◆ n2

float2 n2

◆ n3

float2 n3

◆ n4

float2 n4

◆ weightBonus

float weightBonus

◆ weightFactor

float weightFactor

The documentation for this struct was generated from the following file: