Isosurface.Sampler.CappedCylinder C# (CSharp) Method

CappedCylinder() public static method

public static CappedCylinder ( Vector3 p, Vector2 h ) : float
p Vector3
h Vector2
return float
        public static float CappedCylinder(Vector3 p, Vector2 h)
        {
            Vector2 d = new Vector2((float)Math.Abs(Math.Sqrt(p.X * p.X + p.Z * p.Z)), Math.Abs(p.Y)) - h;
            d = new Vector2(Math.Max(d.X, 0), Math.Max(d.Y, 0));
            float f = Math.Min(Math.Max(d.X, d.Y), 0.0f) + d.Length();
            return f;
        }