TopoShape CreateShape() { GPntList v3list = new GPntList(); double[,] startpiont = new double[1, 3] { { 0, 0, 10 } }; //起点 double length = 10; //波长 double width = 4; //波峰减去波谷差值 int nums = 5; //支点个数 double[,] list = GetVerticalCurveList(startpiont, length, width, nums); for (int i = 0; i < list.GetLength(0); i++) { GPnt P0 = new GPnt(list[i, 0], list[i, 1], list[i, 2]);//直井井室入口 起点 v3list.Add(P0); } GVec aa = new GVec(); aa.SetXYZ(v3list[1].XYZ()); GVec bb = new GVec(); bb.SetXYZ(v3list[0].XYZ()); GDir dir = new GDir(); dir.SetXYZ(aa.Subtracted(bb).XYZ()); TopoShape section = SketchBuilder.MakeCircle(v3list[0], 0.1, dir); TopoShape line9 = SketchBuilder.MakeBSpline(v3list); return(FeatureTool.Sweep(section, line9, EnumGeomFillTrihedron.CorrectedFrenet)); }
public MainWindow() { InitializeComponent(); player.Open(new Uri("C:\\Users\\Mvideo\\Desktop\\kurs-master\\kurs-master\\kurs\\kurs\\sounds\\8-Bit Universe - Our House (8-Bit Version) (8-Bit Version).mp3", UriKind.Relative)); player.Play(); player.Volume = 50.0 / 100.0; using (StreamReader outputFile = new StreamReader(@"C:\Users\Mvideo\Desktop\kurs\kurs\score.txt")) { string line; while ((line = outputFile.ReadLine()) != null) { best.Content = line; } } pakman = new CChar(8, 8); dir = new CDir(8, 8); gh = new Enemy(9, 7); gir = new GDir(8, 5); pmTimer = new System.Windows.Threading.DispatcherTimer(); pmTimer.Tick += new EventHandler(dispatcherTimer_Tick); pmTimer.Interval = new TimeSpan(0, 0, 0, 0, 1); ghTimer = new System.Windows.Threading.DispatcherTimer(); ghTimer.Tick += new EventHandler(dispatcherGhostTimer_Tick); ghTimer.Interval = new TimeSpan(0, 0, 0, 0, 20); DeathTimer = new System.Windows.Threading.DispatcherTimer(); DeathTimer.Tick += new EventHandler(dispatcherDeathTimer_Tick); DeathTimer.Interval = new TimeSpan(0, 0, 0, 0, 20); fillmap2(map, ref Game); pakman.addToScene(ref Game); gh.addToScene(ref Game); //meet(map, ref Game); }
public override void Run(RenderControl render) { GPntList points = new GPntList(); string fileName = GetResourcePath("data/CableViewInfo.txt"); using (StreamReader reader = File.OpenText(fileName)) { while (!reader.EndOfStream) { var line = reader.ReadLine(); var items = line.Split(','); if (items.Length < 3) { continue; } double x = double.Parse(items[0]); double y = double.Parse(items[1]); double z = double.Parse(items[2]); points.Add(new GPnt(x, y, z)); } } var path = SketchBuilder.MakeBSpline(points); render.ShowShape(path, ColorTable.Red); var curve = new ParametricCurve(path); var rt = curve.D1(curve.FirstParameter()); var position = rt.GetPoint(); var dir = new GDir(rt.GetVectors()[0]); var sketch = SketchBuilder.MakeCircle(position, 1, dir); var pipe = FeatureTool.Sweep(sketch, path, EnumGeomFillTrihedron.ConstantNormal); if (pipe != null) { render.ShowShape(pipe, new Vector3(0.8f)); } }
TopoShape Project(TopoShape baseShape, GPnt postion, GDir dir, GDir projDir) { return(ProjectionTool.ProjectOnPlane(baseShape, postion, dir, projDir)); }
public override void Run(RenderControl render) { double dS = 19.0; //弹簧螺距mm double dR = 11.25; //1/2弹簧中径mm double dr1 = 0.9; //内层钢丝半径mm double dr2 = 0.9; //外层钢丝半径mm double dr = dr1 + dr2; //钢丝轴心分布半径mm double da1 = 0.29; //弹簧螺旋角rad double dw0 = 1; //卷簧轴转速rad/s double dw1 = 5; //拧索轴转速rad/s int nOutterCount = 5; //外层钢丝股数 { // create the intter path GPntList pts = new GPntList(); for (double t = 0; t < 10; t += 0.1) { pts.Add(getIntterMultiSpingCoord(t, dS, dR, dw0)); } var path = SketchBuilder.MakeBSpline(pts); // Get the sketch position and direction var curve = new ParametricCurve(path); var rt = curve.D1(curve.FirstParameter()); var position = rt.GetPoint(); var dir = new GDir(rt.GetVectors()[0]); var sketch = SketchBuilder.MakeCircle(position, dr1, dir); // Create pipe var pipe = FeatureTool.Sweep(sketch, path, EnumGeomFillTrihedron.CorrectedFrenet); render.ShowShape(pipe, new Vector3(0.8f)); } Vector3[] colors = new Vector3[] { new Vector3(1.0f, 0, 0), new Vector3(1, 1, 0), new Vector3(0.5f, 1, 0), new Vector3(0, 1, 64 / 255.0f), new Vector3(0, 1, 1) }; // create the outter path for (int i = 0; i < nOutterCount; i++) { GPntList pts = new GPntList(); for (double t = 0; t < 10; t += 0.1) { pts.Add(getOutterMultiSpingCoord(t, dS, dR, dr, da1, dw0, dw1, i * 2 * Math.PI / nOutterCount)); } var path = SketchBuilder.MakeBSpline(pts); // Get the sketch position and direction var curve = new ParametricCurve(path); var rt = curve.D1(curve.FirstParameter()); var position = rt.GetPoint(); var dir = new GDir(rt.GetVectors()[0]); var sketch = SketchBuilder.MakeCircle(position, dr2, dir); // Create pipe var pipe = FeatureTool.Sweep(sketch, path, EnumGeomFillTrihedron.CorrectedFrenet); render.ShowShape(pipe, colors[i]); } }