public void OnSceneGUI()
        {
            PointableCylinder cylinder = target as PointableCylinder;

            if (cylinder.Cylinder != null)
            {
                Draw(cylinder);
            }
        }
        public static void Draw(PointableCylinder pointable)
        {
            Color prevColor = Handles.color;

            Handles.color = pointable.IsValid ? ValidColor : InvalidColor;

            float gizmoHeight    = pointable.Height;
            float camYOffset     = 0;
            bool  infiniteHeight = pointable.Height <= 0;

            if (infiniteHeight && SceneView.lastActiveSceneView?.camera != null)
            {
                gizmoHeight = 1000f;
                Vector3 sceneCamPos = SceneView.lastActiveSceneView.camera.transform.position;
                camYOffset = pointable.Cylinder.transform.InverseTransformPoint(sceneCamPos).y;
            }

            for (int i = 0; i < 2; ++i)
            {
                bool    isTop            = i == 1;
                float   y                = isTop ? gizmoHeight / 2 : -gizmoHeight / 2;
                int     numSegments      = (int)(NUM_SEGMENTS * Mathf.Max(pointable.Radius / 2, 1));
                Vector3 prevSegmentWorld = Vector3.zero;

                for (int seg = 0; seg <= numSegments; ++seg)
                {
                    float   ratio           = (float)seg / numSegments * Mathf.PI * 2;
                    float   x               = Mathf.Cos(ratio) * pointable.Radius;
                    float   z               = Mathf.Sin(ratio) * pointable.Radius;
                    Vector3 curSegmentLocal = new Vector3(x, y + camYOffset, z);
                    Vector3 curSegmentWorld = pointable.Cylinder.transform.TransformPoint(curSegmentLocal);

                    if (isTop) // Draw connecting lines from top circle
                    {
                        Vector3 bottomVert = new Vector3(curSegmentLocal.x,
                                                         curSegmentLocal.y - gizmoHeight,
                                                         curSegmentLocal.z);
                        bottomVert = pointable.Cylinder.transform.TransformPoint(bottomVert);
                        Handles.DrawLine(curSegmentWorld, bottomVert);
                    }

                    if (seg > 0 && !infiniteHeight)
                    {
                        Handles.DrawLine(curSegmentWorld, prevSegmentWorld);
                    }

                    prevSegmentWorld = curSegmentWorld;
                }
            }

            Handles.color = prevColor;
        }