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 |
Methods
advectArrow(dt)
advects an arrow and calls checkDomain
Parameters:
Name | Type | Description |
---|---|---|
dt |
number | delta time |
calcArrowheadRotation() → {number}
determines the angle between p2p3 and x-axis, to rotate the arowhead accordingly
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
Returns:
returns true if arrow is still alive, false if arrow is dead.
- Type
- boolean
getArrowLength() → {number}
Returns:
the distance between first and last handle point
- Type
- number
getLifetime() → {number}
Returns:
the lifetime in milliseconds
- Type
- number
integrateArrow()
integrates an arrow
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 |
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 |
(inner) checkDomain() → {boolean}
check if boundary of domain reached, if yes --> kill (reset)
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 |
Returns:
[x_next, y_next] the next coordinates