/// <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));
        }
 public override Rect GetEncapsulatingRect()
 {
     if (_arePointsDirty)
     {
         OnPointsFoundDirty();
     }
     return(RectEx.FromPoints(_points));
 }
Example #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());
        }
Example #4
0
 private void CalculateRect()
 {
     _rect        = RectEx.FromPoints(_cwPolyPoints);
     _isRectDirty = false;
 }
        public override Rect GetEncapsulatingRect()
        {
            var cornerPoints = QuadMath.Calc2DQuadCornerPoints(_center, _size, _rotationDegrees);

            return(RectEx.FromPoints(cornerPoints));
        }
Example #6
0
 public override Rect GetEncapsulatingRect()
 {
     return(RectEx.FromPoints(GetExtentPoints()));
 }
 public override Rect GetEncapsulatingRect()
 {
     return(RectEx.FromPoints(new Vector2[] { _startPoint, _endPoint }));
 }
 public override Rect GetEncapsulatingRect()
 {
     return(RectEx.FromPoints(new List <Vector2> {
         BaseLeft, Tip, BaseRight
     }));
 }
 private void OnBorderPointsFoundDirty()
 {
     _borderPoints         = PrimitiveFactory.Generate2DArcBorderPoints(_origin, _startPoint, _degreeAngleFromStart, _forceShortestArc, _numBorderPoints);
     _rect                 = RectEx.FromPoints(_borderPoints);
     _areBorderPointsDirty = false;
 }