Class Parametrics
Functions that return Vector2.
Inheritance
Inherited Members
Namespace: Danmokou.DMath.Functions
Assembly: cs.temp.dll.dll
Syntax
public static class Parametrics
Methods
AddAtAngle(ExBPY, ExBPY, ExTP)
Multiply a unit vector at a given angle from the target function by the magnitude, and add it to the target function.
Declaration
public static ExTP AddAtAngle(ExBPY angle, ExBPY magnitude, ExTP tp)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | angle | Angle offset (degrees) |
| ExBPY | magnitude | Magnitude of offset vector |
| ExTP | tp | Target function |
Returns
| Type | Description |
|---|---|
| ExTP |
AddY(ExBPY, ExTP)
Add a function of input to the y-component of a parametric equation.
Declaration
public static ExTP AddY(ExBPY f, ExTP tp)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | f | Function of input |
| ExTP | tp | Parametric equation |
Returns
| Type | Description |
|---|---|
| ExTP |
CR(Single, Single)
Returns a constant vector equal to the Cartesian coordinates for the polar coordinates (r,theta).
Equivalent to PolarToXY(tfloat, tfloat) with constants.
Declaration
public static ExTP CR(float r, float theta)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | r | Radius |
| System.Single | theta | Theta, in degrees |
Returns
| Type | Description |
|---|---|
| ExTP |
CX(Single)
Returns a constant vector with the y-component set to zero.
Declaration
public static ExTP CX(float x)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | X-component |
Returns
| Type | Description |
|---|---|
| ExTP |
CXY(Single, Single)
Returns a constant vector.
Declaration
public static ExTP CXY(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | X-component |
| System.Single | y | Y-component |
Returns
| Type | Description |
|---|---|
| ExTP |
CY(Single)
Returns a constant vector with the x-component set to zero.
Declaration
public static ExTP CY(float y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | y | Y-component |
Returns
| Type | Description |
|---|---|
| ExTP |
Divide(ExBPY, ExTP)
Divide a vector equation by a float equation.
Declaration
public static ExTP Divide(ExBPY by, ExTP tp)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | by | Float equation multiplier |
| ExTP | tp | Base vector equation |
Returns
| Type | Description |
|---|---|
| ExTP |
EaseDVHomeT(String, Single, ExTP)
Short for eased EASE TIME ss0 vhometime TIME LOCATION.
Note: EaseToTarget with NROFFSET is preferred. It has the same signature and avoids Riemann errors.
Declaration
public static ExTP EaseDVHomeT(string smoother, float time, ExTP location)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | smoother | |
| System.Single | time | |
| ExTP | location |
Returns
| Type | Description |
|---|---|
| ExTP |
EaseToTarget(Func<TExArgCtx, TEx<Func<Single, Single>>>, ExBPY, ExTP)
Short for * smooth / t TIME ss0 - LOCATION loc. Use with NROFFSET.
Declaration
public static ExTP EaseToTarget(Func<TExArgCtx, TEx<Func<float, float>>> ease, ExBPY time, ExTP location)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<TExArgCtx, TEx<System.Func<System.Single, System.Single>>> | ease | |
| ExBPY | time | |
| ExTP | location |
Returns
| Type | Description |
|---|---|
| ExTP |
goDown()
Declaration
public static ExTP goDown()
Returns
| Type | Description |
|---|---|
| ExTP |
goLeft()
Declaration
public static ExTP goLeft()
Returns
| Type | Description |
|---|---|
| ExTP |
goOtherSide(ExBPY)
Declaration
public static ExTP goOtherSide(ExBPY y)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | y |
Returns
| Type | Description |
|---|---|
| ExTP |
goRight()
Declaration
public static ExTP goRight()
Returns
| Type | Description |
|---|---|
| ExTP |
goSide(ExBPY)
Declaration
public static ExTP goSide(ExBPY y)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | y |
Returns
| Type | Description |
|---|---|
| ExTP |
goUp()
Declaration
public static ExTP goUp()
Returns
| Type | Description |
|---|---|
| ExTP |
goX(ExBPY)
Declaration
public static ExTP goX(ExBPY x)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | x |
Returns
| Type | Description |
|---|---|
| ExTP |
goY(ExBPY)
Declaration
public static ExTP goY(ExBPY y)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | y |
Returns
| Type | Description |
|---|---|
| ExTP |
LaserRotateLerp(ExBPY, ExTP, ExTP)
Declaration
public static ExTP LaserRotateLerp(ExBPY rate, ExTP from, ExTP to)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | rate | |
| ExTP | from | |
| ExTP | to |
Returns
| Type | Description |
|---|---|
| ExTP |
LerpIn(Single, Single, ExTP)
Lerp from zero to the target parametric.
Declaration
public static ExTP LerpIn(float from_time, float end_time, ExTP p)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | from_time | Time to start lerping |
| System.Single | end_time | Time to end lerping |
| ExTP | p | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
LerpOut(Single, Single, ExTP)
Lerp from the target parametric to zero.
Declaration
public static ExTP LerpOut(float from_time, float end_time, ExTP p)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | from_time | Time to start lerping |
| System.Single | end_time | Time to end lerping |
| ExTP | p | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
LNearestEnemy()
Get the location of the closest enemy. If no enemies exist, default to (0, 50).
WARNING: It is inoptimal to use this in
Declaration
public static ExTP LNearestEnemy()
Returns
| Type | Description |
|---|---|
| ExTP |
LNearestEnemyDefault(ExTP)
Get the location of the closest enemy. If no enemies exist, default to the provided location.
WARNING: It is inoptimal to use this in
Declaration
public static ExTP LNearestEnemyDefault(ExTP deflt)
Parameters
| Type | Name | Description |
|---|---|---|
| ExTP | deflt |
Returns
| Type | Description |
|---|---|
| ExTP |
Loc()
Return the global location of the entity.
Declaration
public static ExTP Loc()
Returns
| Type | Description |
|---|---|
| ExTP |
LSaveNearestEnemy()
Get the location of the closest enemy, preferring the one that was chosen in the previous frame. If no enemies exist, default to (0, 50).
Declaration
public static ExTP LSaveNearestEnemy()
Returns
| Type | Description |
|---|---|
| ExTP |
LSaveNearestEnemyDefault(ExTP)
Get the location of the closest enemy, preferring the one that was chosen in the previous frame. If no enemies exist, default to the provided location.
Declaration
public static ExTP LSaveNearestEnemyDefault(ExTP deflt)
Parameters
| Type | Name | Description |
|---|---|---|
| ExTP | deflt |
Returns
| Type | Description |
|---|---|
| ExTP |
MultiplyX(ExBPY, ExTP)
Multiply the x-component of a parametric equation by a function of input.
Declaration
public static ExTP MultiplyX(ExBPY f, ExTP tp)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | f | Function of input |
| ExTP | tp | Parametric equation |
Returns
| Type | Description |
|---|---|
| ExTP |
MultiplyY(ExBPY, ExTP)
Multiply the y-component of a parametric equation by a function of input.
Declaration
public static ExTP MultiplyY(ExBPY f, ExTP tp)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | f | Function of input |
| ExTP | tp | Parametric equation |
Returns
| Type | Description |
|---|---|
| ExTP |
Pivot(ExBPY, ExBPY, ExTP, ExTP)
Switch between two functions such that the second function continues where the first left off. Eg. Switching from the polar equation (r=1, th=90t) to the xy equation (x=t,y=0) yields: t = 3 -> (0, -1) t = 4 -> (1, -1) t = 5 -> (2, -1)
Declaration
public static ExTP Pivot(ExBPY pivotVar, ExBPY pivot, ExTP f1, ExTP f2)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | pivotVar | The variable upon which pivoting is performed. Should be either "p" (firing index) or "t" (time). |
| ExBPY | pivot | The value of the variable at which pivoting is performed |
| ExTP | f1 | Starting equation |
| ExTP | f2 | Equation after pivot |
Returns
| Type | Description |
|---|---|
| ExTP |
PX(ExBPY)
= PXY x 0
Declaration
public static ExTP PX(ExBPY x)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | x |
Returns
| Type | Description |
|---|---|
| ExTP |
PXY(ExBPY, ExBPY)
Derive a Vector2 from two floats.
Declaration
public static ExTP PXY(ExBPY x, ExBPY y)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | x | Float assigned to X-component |
| ExBPY | y | Float assigned to Y-component |
Returns
| Type | Description |
|---|---|
| ExTP |
PY(ExBPY)
= PXY 0 y
Declaration
public static ExTP PY(ExBPY y)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | y |
Returns
| Type | Description |
|---|---|
| ExTP |
Root()
The starting position of a bullet.
Declaration
public static ExTP Root()
Returns
| Type | Description |
|---|---|
| ExTP |
RotateLerpPercent(ExBPY, ExTP, ExTP)
Rotate between two parametrics (the magnitude of the resulting vector is the magnitude of the from vector), closing ratio fraction of the gap per second.
Declaration
public static ExTP RotateLerpPercent(ExBPY ratio, ExTP from, ExTP to)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | ratio | Fraction of gap to close per second |
| ExTP | from | Source parametric |
| ExTP | to | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
Remarks
In many cases, TrueRotateLerp is more accurate. If you're experiencing strange behavior, try those functions instead.
RotateLerpRate(ExBPY, ExTP, ExTP)
Rotate between two parametrics (the magnitude of the resulting vector is the magnitude of the from vector), closing rate degrees of the gap per second.
Declaration
public static ExTP RotateLerpRate(ExBPY rate, ExTP from, ExTP to)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | rate | Degrees of gap to close per second |
| ExTP | from | Source parametric |
| ExTP | to | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
Remarks
In many cases, TrueRotateLerp is more accurate. If you're experiencing strange behavior, try those functions instead.
Rotify(ExTP)
Rotate a Cartesian parametric function by the firing angle of the entity.
tprot p = tpnrot rotify p
Declaration
public static ExTP Rotify(ExTP p)
Parameters
| Type | Name | Description |
|---|---|---|
| ExTP | p | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
SSVHomeT(ExBPY, ExTP)
Short for ss0 vhometime TIME LOCATION.
Declaration
public static ExTP SSVHomeT(ExBPY time, ExTP location)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | time | |
| ExTP | location |
Returns
| Type | Description |
|---|---|
| ExTP |
Switch(Single, ExTP, ExTP)
Switch between two parametrics based on time.
Declaration
public static ExTP Switch(float at_time, ExTP from, ExTP to)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | at_time | Switch reference |
| ExTP | from | Parametric to return before switch |
| ExTP | to | Parametric to return after switch |
Returns
| Type | Description |
|---|---|
| ExTP |
TP(ExTP3)
Derive a Vector2 from a Vector3 by dropping the Z-component.
Declaration
public static ExTP TP(ExTP3 xyz)
Parameters
| Type | Name | Description |
|---|---|---|
| ExTP3 | xyz |
Returns
| Type | Description |
|---|---|
| ExTP |
TrueRotateLerpPercent(ExBPY, ExTP, ExTP)
Rotate between two parametrics (the magnitude of the resulting vector is the magnitude of the from vector), closing ratio fraction of the gap per second.
This function uses the last returned value as its rotation source, only sampling the source parametric once.
Declaration
public static ExTP TrueRotateLerpPercent(ExBPY ratio, ExTP from, ExTP to)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | ratio | Fraction of gap to close per second |
| ExTP | from | Source parametric |
| ExTP | to | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
Remarks
Ratio is not multiplicative as in RotateLerpPercent. Instead, it accumulates like the function 1-e^-rt. This means that the rotation is faster during the first second than the second second, and so on. Use TrueRotateLerpRate for constant rotation rates.
TrueRotateLerpRate(ExBPY, ExTP, ExTP)
Rotate between two parametrics (the magnitude of the resulting vector is the magnitude of the from vector), closing rate degrees of the gap per second.
This function uses the last returned value as its rotation source, only sampling the source parametric once.
Declaration
public static ExTP TrueRotateLerpRate(ExBPY rate, ExTP from, ExTP to)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | rate | Degrees of gap to close per second |
| ExTP | from | Source parametric |
| ExTP | to | Target parametric |
Returns
| Type | Description |
|---|---|
| ExTP |
VHome(ExBPY, ExTP)
Home towards a target location at a fixed speed.
Declaration
public static ExTP VHome(ExBPY speed, ExTP location)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | speed | Speed |
| ExTP | location | Target location |
Returns
| Type | Description |
|---|---|
| ExTP |
Remarks
Use with StopSampling to home for only a few seconds.
This is primarily for use with non-rotational velocity.
Rotational use creates: contracting spirals (0,90), circle around player [90], expanding spiral (90,180).
VHomeTime(ExBPY, ExTP)
Home towards a target location at a speed such that the target will be reached in time seconds. Do not set time to 0. Best used with stopsampling 0.
Declaration
public static ExTP VHomeTime(ExBPY time, ExTP location)
Parameters
| Type | Name | Description |
|---|---|---|
| ExBPY | time | Time in seconds |
| ExTP | location | Target location |
Returns
| Type | Description |
|---|---|
| ExTP |
Zero()
The zero vector.
Declaration
public static ExTP Zero()
Returns
| Type | Description |
|---|---|
| ExTP |