public override void SupportMapping(ref TSVector direction, out TSVector result) { FP fP = FP.Sqrt(direction.x * direction.x + direction.z * direction.z); bool flag = FP.Abs(direction.y) > FP.Zero; if (flag) { TSVector tSVector; TSVector.Normalize(ref direction, out tSVector); TSVector.Multiply(ref tSVector, this.radius, out result); result.y += FP.Sign(direction.y) * FP.Half * this.length; } else { bool flag2 = fP > FP.Zero; if (flag2) { result.x = direction.x / fP * this.radius; result.y = FP.Zero; result.z = direction.z / fP * this.radius; } else { result.x = FP.Zero; result.y = FP.Zero; result.z = FP.Zero; } } }
public override void SupportMapping(ref TSVector direction, out TSVector result) { FP fP = FP.Sqrt(direction.x * direction.x + direction.z * direction.z); bool flag = fP > FP.Zero; if (flag) { result.x = direction.x / fP * this.radius; result.y = FP.Sign(direction.y) * this.height * FP.Half; result.z = direction.z / fP * this.radius; } else { result.x = FP.Zero; result.y = FP.Sign(direction.y) * this.height * FP.Half; result.z = FP.Zero; } }
/// <summary> /// Returns a number indicating the sign of a Fix64 number. /// Returns 1 if the value is positive, 0 if is 0, and -1 if it is negative. /// </summary> public static int Sign(FP value) { return(FP.Sign(value)); }
public override void SupportMapping(ref TSVector direction, out TSVector result) { result.x = FP.Sign(direction.x) * this.halfSize.x; result.y = FP.Sign(direction.y) * this.halfSize.y; result.z = FP.Sign(direction.z) * this.halfSize.z; }