Esempio n. 1
0
        /// <summary>
        /// Calculates and returns the rectangle that encloses all the 2D shapes which belong to
        /// the handle. If the handle doesn't contain any 2D shapes or if none of them are marked
        /// as visible, a rectangle with the size of 0 will be returned. The 'Is2DVisible' property
        /// is ignored. The function will also return an empty rect if the 3D position of the owner
        /// gizmo falls behind the camera near plane (i.e. behind the camera).
        /// </summary>
        public Rect GetVisible2DShapesRect(Camera camera)
        {
            if (Num2DShapes == 0 ||
                !camera.IsPointInFrontNearPlane(Gizmo.Transform.Position3D))
            {
                return(new Rect());
            }

            var allRectPts = new List <Vector2>(Num2DShapes * 4);

            foreach (var shape in _2DShapes)
            {
                if (!shape.IsVisible)
                {
                    continue;
                }

                Rect shapeRect = shape.Shape.GetEncapsulatingRect();
                allRectPts.AddRange(shapeRect.GetCornerPoints());
            }

            if (allRectPts.Count == 0)
            {
                return(new Rect());
            }
            return(RectEx.FromPoints(allRectPts));
        }
Esempio n. 2
0
 public override Rect GetEncapsulatingRect()
 {
     if (_arePointsDirty)
     {
         OnPointsFoundDirty();
     }
     return(RectEx.FromPoints(_points));
 }
Esempio n. 3
0
        public Rect GetVisible2DHandlesRect(Camera camera)
        {
            var allRectPts = new List <Vector2>();
            int numHandles = _handles.Count;

            for (int handleIndex = 0; handleIndex < numHandles; ++handleIndex)
            {
                var  handle     = _handles[handleIndex];
                Rect handleRect = handle.GetVisible2DShapesRect(camera);
                if (handleRect.width != 0 || handleRect.height != 0)
                {
                    allRectPts.AddRange(handleRect.GetCornerPoints());
                }
            }

            if (allRectPts.Count != 0)
            {
                return(RectEx.FromPoints(allRectPts));
            }
            return(new Rect());
        }
Esempio n. 4
0
 public override Rect GetEncapsulatingRect()
 {
     return(RectEx.FromPoints(new List <Vector2> {
         BaseLeft, Tip, BaseRight
     }));
 }
Esempio n. 5
0
 public override Rect GetEncapsulatingRect()
 {
     return(RectEx.FromPoints(GetPoints()));
 }
Esempio n. 6
0
 private void OnBorderPointsFoundDirty()
 {
     _borderPoints         = PrimitiveFactory.Generate2DArcBorderPoints(_origin, _startPoint, _degreeAngleFromStart, _forceShortestArc, _numBorderPoints);
     _rect                 = RectEx.FromPoints(_borderPoints);
     _areBorderPointsDirty = false;
 }
Esempio n. 7
0
 public override Rect GetEncapsulatingRect()
 {
     return(RectEx.FromPoints(new Vector2[] { _startPoint, _endPoint }));
 }
Esempio n. 8
0
 private void CalculateRect()
 {
     _rect = RectEx.FromPoints(_cwPolyPoints);
     _isRectDirty = false;
 }
Esempio n. 9
0
        public override Rect GetEncapsulatingRect()
        {
            var cornerPoints = QuadMath.Calc2DQuadCornerPoints(_center, _size, _rotationDegrees);

            return(RectEx.FromPoints(cornerPoints));
        }
Esempio n. 10
0
 public override Rect GetEncapsulatingRect()
 {
     System.Collections.Generic.List <Vector2> cornerPoints = QuadMath.Calc2DQuadCornerPoints(_center, _size, _rotationDegrees);
     return(RectEx.FromPoints(cornerPoints));
 }