BEPUphysics.CollisionShapes.ConvexShapes.ConeShape.GetLocalExtremePointWithoutMargin C# (CSharp) Method

GetLocalExtremePointWithoutMargin() public method

Gets the extreme point of the shape in local space in a given direction.
public GetLocalExtremePointWithoutMargin ( Vector3 &direction, Vector3 &extremePoint ) : void
direction Vector3 Direction to find the extreme point in.
extremePoint Vector3 Extreme point on the shape.
return void
        public override void GetLocalExtremePointWithoutMargin(ref Vector3 direction, out Vector3 extremePoint)
        {
            //Is it the tip of the cone?
            float sinThetaSquared = radius * radius / (radius * radius + height * height);
            //If d.Y * d.Y / d.LengthSquared >= sinthetaSquared
            if (direction.Y > 0 && direction.Y * direction.Y >= direction.LengthSquared() * sinThetaSquared)
            {
                extremePoint = new Vector3(0, .75f * height, 0);
                return;
            }
            //Is it a bottom edge of the cone?
            float horizontalLengthSquared = direction.X * direction.X + direction.Z * direction.Z;
            if (horizontalLengthSquared > Toolbox.Epsilon)
            {
                var radOverSigma = radius / Math.Sqrt(horizontalLengthSquared);
                extremePoint = new Vector3((float)(radOverSigma * direction.X), -.25f * height, (float)(radOverSigma * direction.Z));
            }
            else // It's pointing almost straight down...
                extremePoint = new Vector3(0, -.25f * height, 0);


        }