示例#1
0
        override public void SetLocalFrame(Frame3f newFrame, CoordSpace eSpace)
        {
            if (Parent != GetScene())
            {
                throw new Exception("SlicePlaneHeightSO.SetLocalFrame: unsupported");
            }

            Frame3f newSceneFrame = newFrame;

            if (eSpace == CoordSpace.WorldCoords)
            {
                newSceneFrame = SceneTransforms.WorldToScene(GetScene(), newFrame);
            }

            Line3d    axis = new Line3d(ConstraintFrameS.Origin, Vector3d.AxisY);
            Segment3d seg  = new Segment3d(axis.ClosestPoint(MinPosS), axis.ClosestPoint(MaxPosS));
            Vector3d  cp   = seg.NearestPoint(newSceneFrame.Origin);

            newSceneFrame.Origin = (Vector3f)cp;
            base.SetLocalFrame(newSceneFrame, CoordSpace.SceneCoords);
        }
        public override void Setup()
        {
            StartPointID = AppendSurfacePoint("StartPoint", Colorf.Blue);
            EndPointID   = AppendSurfacePoint("EndPoint", Colorf.Green);

            //LineIndicator line = new LineIndicator() {
            //    LineWidth = fDimension.Scene(1.0f),
            //    SceneStartF = () => { return GizmoPoints[StartPointID].currentFrameS.Origin; },
            //    SceneEndF = () => { return GizmoPoints[EndPointID].currentFrameS.Origin; },
            //};
            //indicators.AddIndicator(line);
            //indicators.SetLayer(line, FPlatform.HUDOverlay);   // has to be hud overlay or it will be clipped by depth render

            Frame3f TargetFrameS = TargetSO.GetLocalFrame(CoordSpace.SceneCoords);

            TargetAxis = new Line3d(TargetFrameS.Origin, Vector3d.AxisY);

            SectionPlaneIndicator startPlane = IndicatorBuilder.MakeSectionPlaneIndicator(
                100, "startPlane",
                fDimension.Scene(plane_indicator_width),
                () => { return(new Frame3f(TargetAxis.ClosestPoint(GizmoPoints[StartPointID].currentFrameS.Origin))); },
                () => { return(new Colorf(Colorf.LightGreen, 0.5f)); },
                () => { return(true); }
                );

            Indicators.AddIndicator(startPlane);

            SectionPlaneIndicator endPlane = IndicatorBuilder.MakeSectionPlaneIndicator(
                101, "endPlane",
                fDimension.Scene(plane_indicator_width),
                () => { return(new Frame3f(TargetAxis.ClosestPoint(GizmoPoints[EndPointID].currentFrameS.Origin))); },
                () => { return(new Colorf(Colorf.LightGreen, 0.5f)); },
                () => { return(true); }
                );

            Indicators.AddIndicator(endPlane);
        }