Пример #1
0
    void OnDrawGizmosSelected()
    {
        Cup cup = new Cup(cup_p1, cup_p2, cup_p3);

        foreach (var side in cup.GetSides())
        {
            Gizmos.DrawLine(side.p1, side.p2);
        }
        Gizmos.DrawSphere(cup_p3, drawRadius);

        if (cup.Contains(point, epsilon))
        {
            Gizmos.color = Color.green;
        }
        else
        {
            Gizmos.color = Color.red;
        }
        Gizmos.DrawSphere(point, drawRadius);
    }
Пример #2
0
    //bool cupIntersection = true;
    //bool triangleIntersection = false;


    void OnDrawGizmosSelected()
    {
        LineSegment seg = new LineSegment(seg_p1, seg_p2);
        Cup         cup = new Cup(cup_p1, cup_p2, cup_p3);

        Gizmos.color = Color.white;
        if (cupSubtraction)
        {
            foreach (var side in cup.GetSides())
            {
                Gizmos.DrawLine(side.p1, side.p2);
            }
            Gizmos.DrawSphere(seg.p1, .1f);
            Gizmos.DrawSphere(seg.p2, .1f);

            Gizmos.color = Color.red;
            foreach (var split in seg.Subtract(cup, new List <LineSegment>()))
            {
                Gizmos.DrawLine(split.p1, split.p2);
            }
        }
    }