private void CalculatePointsPlane(OrientedBox orientedBox, SnapSurface objectSnapSurface)
 {
     // Note: It is necessary to ensure that all projected points sit right below the oriented box in order
     //       to avoid situations in which the object hierarchy floats in the air or becomes embedded
     //       inside other objects. In order to do this, we adjust the surface plane such that the box
     //       sits right in front of it (or behind) depending on the settings.
     _pointsPlane = objectSnapSurface.Plane;
     if (AllShortcutCombos.Instance.PlaceGuideBehindSurfacePlane.IsActive())
     {
         _pointsPlane = _pointsPlane.AdjustSoBoxSitsBehind(orientedBox);
     }
     else
     {
         _pointsPlane = _pointsPlane.AdjustSoBoxSitsInFront(orientedBox);
     }
 }
        public void FromOrientedBoxAndSnapSurface(OrientedBox orientedBox, SnapSurface objectSnapSurface)
        {
            if (!objectSnapSurface.IsValid)
            {
                return;
            }

            Vector3 surfacePlaneNormal = objectSnapSurface.Plane.normal;

            if (AllShortcutCombos.Instance.PlaceGuideBehindSurfacePlane.IsActive())
            {
                surfacePlaneNormal *= -1.0f;
            }

            BoxFace        boxFaceMostAlignedWithSurface            = orientedBox.GetBoxFaceWhichFacesNormal(surfacePlaneNormal);
            List <Vector3> cornerPointsOfFaceMostAlignedWithSurface = orientedBox.GetBoxFaceCornerPoints(boxFaceMostAlignedWithSurface);

            CalculatePointsPlane(orientedBox, objectSnapSurface);

            StoreObjectPivotPoints(_pointsPlane.ProjectAllPoints(cornerPointsOfFaceMostAlignedWithSurface));
            StoreUnprojectedPivotPoints(cornerPointsOfFaceMostAlignedWithSurface);
            CalculateArea();
        }