public void PreDraw(Hisui.Graphics.ISceneContext sc) { if (this.Direction == ClipDirections.None) { return; } var sphere = _docviews.WorldDocumentScene.BoundingSphere; var range = new Hisui.Geom.Range(-sphere.Radius, sphere.Radius); var codsys = Geom.CodSys3d.Unit; switch (this.Direction) { case ClipDirections.View: codsys.r = sc.Camera.ViewingPos.r; codsys.SetRotation(codsys.v, codsys.u); break; case ClipDirections.PlusX: codsys.SetRotation(Geom.Vector3d.Ey, Geom.Vector3d.Ez); break; case ClipDirections.PlusY: codsys.SetRotation(Geom.Vector3d.Ez, Geom.Vector3d.Ex); break; case ClipDirections.PlusZ: codsys.SetRotation(Geom.Vector3d.Ex, Geom.Vector3d.Ey); break; case ClipDirections.MinusX: codsys.SetRotation(Geom.Vector3d.Ez, Geom.Vector3d.Ey); break; case ClipDirections.MinusY: codsys.SetRotation(Geom.Vector3d.Ex, Geom.Vector3d.Ez); break; case ClipDirections.MinusZ: codsys.SetRotation(Geom.Vector3d.Ey, Geom.Vector3d.Ex); break; } codsys.o = sphere.Center + range.ParamToValue(this.Position) * codsys.n; _clip.CodSys = codsys; _clip.PreDraw(sc); }
IEnumerator <Ctrl.IOperation> DragPlane(Graphics.IView view, MouseEventArgs e) { var plane = this.GetQuadPlanes()[_highlightIndex]; var sphere = _docviews.WorldDocumentScene.BoundingSphere; var range = new Hisui.Geom.Range(-sphere.Radius, sphere.Radius); var z0 = range.ParamToValue(this.Position); var eyeshot1 = view.Camera.GetEyeshotLine(e.Location); var y1 = GetIntersection(plane, eyeshot1).y; var up = new Ctrl.LButtonUp(view.Events); up.MouseMove += (ss, ee) => { var eyeshot2 = view.Camera.GetEyeshotLine(ee.Location); var z = z0 + GetIntersection(plane, eyeshot2).y - y1; this.Position = range.ValueToParam(z); view.Invalidate(); }; yield return(up); view.Invalidate(); }
IEnumerator<Ctrl.IOperation> DragPlane( Graphics.IView view, MouseEventArgs e ) { var plane = this.GetQuadPlanes()[_highlightIndex]; var sphere = _docviews.WorldDocumentScene.BoundingSphere; var range = new Hisui.Geom.Range( -sphere.Radius, sphere.Radius ); var z0 = range.ParamToValue( this.Position ); var eyeshot1 = view.Camera.GetEyeshotLine( e.Location ); var y1 = GetIntersection( plane, eyeshot1 ).y; var up = new Ctrl.LButtonUp( view.Events ); up.MouseMove += ( ss, ee ) => { var eyeshot2 = view.Camera.GetEyeshotLine( ee.Location ); var z = z0 + GetIntersection( plane, eyeshot2 ).y - y1; this.Position = range.ValueToParam( z ); view.Invalidate(); }; yield return up; view.Invalidate(); }
public void PreDraw( Hisui.Graphics.ISceneContext sc ) { if ( this.Direction == ClipDirections.None ) return; var sphere = _docviews.WorldDocumentScene.BoundingSphere; var range = new Hisui.Geom.Range( -sphere.Radius, sphere.Radius ); var codsys = Geom.CodSys3d.Unit; switch ( this.Direction ) { case ClipDirections.View: codsys.r = sc.Camera.ViewingPos.r; codsys.SetRotation( codsys.v, codsys.u ); break; case ClipDirections.PlusX: codsys.SetRotation( Geom.Vector3d.Ey, Geom.Vector3d.Ez ); break; case ClipDirections.PlusY: codsys.SetRotation( Geom.Vector3d.Ez, Geom.Vector3d.Ex ); break; case ClipDirections.PlusZ: codsys.SetRotation( Geom.Vector3d.Ex, Geom.Vector3d.Ey ); break; case ClipDirections.MinusX: codsys.SetRotation( Geom.Vector3d.Ez, Geom.Vector3d.Ey ); break; case ClipDirections.MinusY: codsys.SetRotation( Geom.Vector3d.Ex, Geom.Vector3d.Ez ); break; case ClipDirections.MinusZ: codsys.SetRotation( Geom.Vector3d.Ey, Geom.Vector3d.Ex ); break; } codsys.o = sphere.Center + range.ParamToValue( this.Position ) * codsys.n; _clip.CodSys = codsys; _clip.PreDraw( sc ); }