Class: Arrow

Arrow

new Arrow(posX, posY, velocity, velocityField, distanceMap)

Parameters:
Name Type Description
posX number position coordinate
posY number position coordinate
velocity number -
velocityField VelocityField the velocity field where the arrow lives in
distanceMap DistanceMap the related distance map
Source:

Methods

advectArrow(dt)

advects an arrow and calls checkDomain
Parameters:
Name Type Description
dt number delta time
Source:

calcArrowheadRotation() → {number}

determines the angle between p2p3 and x-axis, to rotate the arowhead accordingly
Source:
Returns:
the angle
Type
number

checkAndMarkOccupied() → {boolean}

checks if arrow is colliding with another arrow if no collision --> marks this area in the velocity field as occupied and returns true, so the arrowManager inserts the arrow
Source:
Returns:
returns true if arrow is still alive, false if arrow is dead.
Type
boolean

getArrowLength() → {number}

Source:
Returns:
the distance between first and last handle point
Type
number

getLifetime() → {number}

Source:
Returns:
the lifetime in milliseconds
Type
number

integrateArrow()

integrates an arrow
Source:

linearInterpolation(start, end, step) → {number}

linear interpolation between two numbers
Parameters:
Name Type Description
start number start point
end number end point
step number the interpolation step
Source:
Returns:
interpolated point at interpolation step
Type
number

respawn(posX, posY)

Respawning the arrow gives it a new position at the moment and resets the handle points
Parameters:
Name Type Description
posX number x position
posY number y position
Source:

(inner) checkDomain() → {boolean}

check if boundary of domain reached, if yes --> kill (reset)
Source:
Returns:
false if arrow has reached boundary
Type
boolean

(inner) rk4avg(x, y, dt)

RK4 using averaged values
Parameters:
Name Type Description
x number "real" coordinate of the current point
y number "real" coordinate of the current point
dt number stepsize
Source:
Returns:
[x_next, y_next] the next coordinates