public static float Cylinder(Vector3 p, Vector3 h) { Vector2 a = new Vector2(p.X, p.Z); Vector2 b = new Vector2(h.X, h.Y); return (a - b).Length() - h.Z; }