public void Project(RotateCoeffs rotate, Point3D camera) { double x = Point3D.IntToMm(this.x); double y = Point3D.IntToMm(this.y); double z = Point3D.IntToMm(this.z); x -= Point3D.IntToMm(camera.x); y -= Point3D.IntToMm(camera.y); z -= Point3D.IntToMm(camera.z); if ((rotate.CosX != 1f) && (rotate.SinX != 0f)) { double y0 = y; y = (y0 * rotate.CosX) + (z * -rotate.SinX); z = (y0 * rotate.SinX) + (z * rotate.CosX); } if ((rotate.CosY != 1f) && (rotate.SinY != 0f)) { double x0 = x; x = (x0 * rotate.CosY) + (z * rotate.SinY); z = (x0 * -rotate.SinY) + (z * rotate.CosY); } if ((rotate.CosZ != 1f) && (rotate.SinZ != 0f)) { double x0 = x; x = (x0 * rotate.CosZ) + (y * -rotate.SinZ); y = (x0 * rotate.SinZ) + (y * rotate.CosZ); } this.x = Point3D.MmToInt(x); this.y = Point3D.MmToInt(y); this.z = Point3D.MmToInt(z); }
public static Text3D FromString(string s, Font font, double height, FontStyle style, int flatFactor) { GraphicsPath path = new GraphicsPath(); int h = Point3D.MmToInt(height); path.AddString(s, font.FontFamily, (int)style, h, new RectangleF(0, 0, Single.MaxValue, Single.MaxValue), StringFormat.GenericDefault); if (flatFactor <= 0) { flatFactor = 100; } path.Flatten(null, (Single)h / (Single)flatFactor); PathData pd = path.PathData; Text3D t = new Text3D(); int px = 0; int py = 0; int px0 = 0; int py0 = 0; for (int i = 0; i < pd.Points.Length; i++) { int px1 = (int)pd.Points[i].X; int py1 = (int)pd.Points[i].Y; switch ((byte)((int)pd.Types[i] & 0x07)) { case (byte)PathPointType.Line: t.points.Add(new Text3DPoint(Text3DPointType.LineTo, px1, py1)); break; case (byte)PathPointType.Start: px0 = px1; py0 = py1; t.points.Add(new Text3DPoint(Text3DPointType.StartPoint, px1, py1)); break; } if (((int)pd.Types[i] & (int)PathPointType.CloseSubpath) != 0) { t.points.Add(new Text3DPoint(Text3DPointType.LineTo, px0, py0)); } px = px1; py = py1; } return(t); }
public void ApplyViewer(Point3D viewer) { double x = Point3D.IntToMm(this.x); double y = Point3D.IntToMm(this.y); double z = Point3D.IntToMm(this.z); double ex = Point3D.IntToMm(viewer.x); double ey = Point3D.IntToMm(viewer.y); double ez = Point3D.IntToMm(viewer.z); x = (x - ex) * (ez / z); y = (y - ey) * (ez / z); this.x = Point3D.MmToInt(x); this.y = Point3D.MmToInt(y); this.z = Point3D.MmToInt(z); }
public Text3DPoint(double x, double y) { this.Type = Text3DPointType.StartPoint; this.X = Point3D.MmToInt(x); this.Y = Point3D.MmToInt(y); }
public Point3D(float x, float y, float z) : this(Point3D.MmToInt(x), Point3D.MmToInt(y), Point3D.MmToInt(z)) { }
public Point3D(double x, double y, double z) : this(Point3D.MmToInt(x), Point3D.MmToInt(y), Point3D.MmToInt(z)) { }
/// <summary> /// Text 3D /// </summary> /// <param name="tag"></param> /// <param name="text"></param> /// <param name="location"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="coordinate"></param> public void Text(int tag, Text3D text, Text3DLocation location, Text3DFlip flip, float x, float y, float coordinate) { this.Text(tag, text, location, flip, Point3D.MmToInt(x), Point3D.MmToInt(y), Point3D.MmToInt(coordinate)); }