private void DrawXAxisMinorTicks(Point3DCollection points) { Point3DCollection pointsColl = new Point3DCollection(); var minorTicks = this.TicksProvider.CreateMinorTicks(_xRange, _length); foreach (var tick in minorTicks) { Point3D start = new Point3D() { X = tick.AxisValue, Y = 0, Z = _length }; Point3D end = new Point3D() { X = tick.AxisValue, Y = 0, Z = _length - this.TicksProvider.MinorTickSize }; pointsColl.Add(start); pointsColl.Add(end); } //Add (1,0,0) side minor ticks Point3D[] oneSidesPoints = new Point3D[pointsColl.Count]; pointsColl.CopyTo(oneSidesPoints, 0); Transform3D transform = new TranslateTransform3D() { OffsetX = 0, OffsetY = 0, OffsetZ = this.TicksProvider.MinorTickSize - _length }; AddTransformedPoints(pointsColl, transform, oneSidesPoints); //Add the other two sides points on XOZ Point3D[] towSidesPoints = new Point3D[pointsColl.Count]; pointsColl.CopyTo(towSidesPoints, 0); transform = new RotateTransform3D() { CenterX = _length / 2, CenterY = 0, CenterZ = _length / 2, Rotation = new AxisAngleRotation3D() { Axis = new Vector3D(0, 1, 0), Angle = 90 } }; AddTransformedPoints(pointsColl, transform, towSidesPoints); foreach (var point in pointsColl) { points.Add(point); } }
public static Point3DCollection RotatePoint3DCollection(Point3DCollection p, Matrix3D m) { /*Matrix3D m = new Matrix3D( * 1,0, 0, 0, * 0,1, 0, 0, * 0, 0, 1, 0, * 1, 0, 0, 1); //last column */ int pcSize = p.Count; Point3D[] k = new Point3D[pcSize]; p.CopyTo(k, 0); p.Clear(); m.Transform(k); for (int i = 0; i < pcSize; i++) { p.Add(k[i]); } return(p); }
public ModelVisual3D DrawAxisGrid() { Point3DCollection points = new Point3DCollection(); DrawXOZAxisGrid(points); Point3D[] sufacePoints = new Point3D[points.Count]; points.CopyTo(sufacePoints, 0);//XOZ Point AddYOZFromXOZ(points, sufacePoints); //Now sufacePoints is YOZ points AddXOYFromYOZ(points, sufacePoints); LinesVisual3D axisLines = new LinesVisual3D() { Color = Colors.Blue, Thickness = 1 }; axisLines.Points = points; axisVisuals.Children.Add(axisLines); DrawXAxisLabels(); DrawYAxisLabels(); DrawZAxisLabels(); ModelVisual3D tickLabels = new ModelVisual3D(); tickLabels.Content = mayorTickLabelGroup; axisVisuals.Children.Add(tickLabels); ModelVisual3D axisLabels = new ModelVisual3D(); axisLabels.Content = axisLabelGroup; axisVisuals.Children.Add(axisLabels); return(axisVisuals); }