refactor(Hi.Sample)!: Box3d, Tri3d, DVec3d and Box2d are named box3d_t, tri3d_t, dvec3d_t and box2d_t -- the C++ typedef names, following HiGeom; the Hi.Native vec3d/tri3d/box3d mirrors are the Hi.Geom values now and vec3f is Hi.Geom.vec3f_t (a word-boundary identifier rename; compound names, string literals and the wire kind names are untouched)

BREAKING CHANGE: source that names these types must use the _t names; the Hi.Native mirrors are gone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 13:54:35 +08:00
co-authored by Claude Fable 5.1
parent 7d79db5685
commit 1b834cff0d
14 changed files with 33 additions and 33 deletions
+4 -4
View File
@@ -20,16 +20,16 @@ namespace Sample.Disp
public void Display(Bind bind) public void Display(Bind bind)
{ {
bind.Rgb = ColorUtil.GetDiscreteRGB_Env(); bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
new Box3d(0, 0, 0, 1, 1, 1).ToDraw_Face().Display(bind); new box3d_t(0, 0, 0, 1, 1, 1).ToDraw_Face().Display(bind);
bind.Rgb = ColorUtil.GetDiscreteRGB_Env(); bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
new Box3d(1, 0, 0, 2, 1, 1).ToDraw_Face().Display(bind); new box3d_t(1, 0, 0, 2, 1, 1).ToDraw_Face().Display(bind);
bind.Rgb = ColorUtil.GetDiscreteRGB_Env(); bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
new Box3d(2, 0, 0, 3, 1, 1).ToDraw_Face().Display(bind); new box3d_t(2, 0, 0, 3, 1, 1).ToDraw_Face().Display(bind);
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
dst = dst.Expanded(new vec3d_t(0, 0, 0)); dst = dst.Expanded(new vec3d_t(0, 0, 0));
dst = dst.Expanded(new vec3d_t(3, 1, 1)); dst = dst.Expanded(new vec3d_t(3, 1, 1));
+5 -5
View File
@@ -126,7 +126,7 @@ namespace Sample.Disp
{ {
//the rgb values set as casual. //the rgb values set as casual.
vec3d_t rgb = ColorUtil.GetDiscreteRgb(i); vec3d_t rgb = ColorUtil.GetDiscreteRgb(i);
Tri3d tri = new Tri3d(new vec3d_t(i, 0, 0), new vec3d_t(i + 1, 0, 0), new vec3d_t(i + 0.5, 0, 1)); tri3d_t tri = new tri3d_t(new vec3d_t(i, 0, 0), new vec3d_t(i + 1, 0, 0), new vec3d_t(i + 0.5, 0, 1));
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
vs[k++] = rgb.x; vs[k++] = rgb.x;
@@ -147,7 +147,7 @@ namespace Sample.Disp
{ {
//the rgb values set as casual. //the rgb values set as casual.
vec3d_t rgb = ColorUtil.GetDiscreteRgb(i); vec3d_t rgb = ColorUtil.GetDiscreteRgb(i);
Tri3d tri = new Tri3d(new vec3d_t(i, 0, 3), new vec3d_t(i + 1, 0, 3), new vec3d_t(i + 0.5, 0, 4)); tri3d_t tri = new tri3d_t(new vec3d_t(i, 0, 3), new vec3d_t(i + 1, 0, 3), new vec3d_t(i + 0.5, 0, 4));
vec3d_t nn = tri.GetNormal(); vec3d_t nn = tri.GetNormal();
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
@@ -171,16 +171,16 @@ namespace Sample.Disp
} }
/// <summary> /// <summary>
/// Demonstrates drawing 3D triangles using the Tri3d helper class. /// Demonstrates drawing 3D triangles using the tri3d_t helper class.
/// Creates a series of triangles and renders them as both face (filled) and line (wireframe) drawings. /// Creates a series of triangles and renders them as both face (filled) and line (wireframe) drawings.
/// Shows how to apply different colors to faces and lines of the same geometry. /// Shows how to apply different colors to faces and lines of the same geometry.
/// </summary> /// </summary>
public static void DrawTri3d() public static void DrawTri3d()
{ {
int n = 10; int n = 10;
List<Tri3d> tris = new List<Tri3d>(n); List<tri3d_t> tris = new List<tri3d_t>(n);
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
tris.Add(new Tri3d(new vec3d_t(i, 0, 0), new vec3d_t(i + 1, 0, 0), new vec3d_t(i + 0.5, 0, 1))); tris.Add(new tri3d_t(new vec3d_t(i, 0, 0), new vec3d_t(i + 1, 0, 0), new vec3d_t(i + 0.5, 0, 1)));
Drawing faceDraw = tris.GetFaceDrawing(); Drawing faceDraw = tris.GetFaceDrawing();
Drawing linesDraw = tris.ToLineDrawing(); Drawing linesDraw = tris.ToLineDrawing();
+2 -2
View File
@@ -21,11 +21,11 @@ namespace Sample.Disp
{ {
bind.PickID = PickingID; bind.PickID = PickingID;
bind.Rgb = new vec3d_t(isMouseOver ? 0 : 1, 1, 1); bind.Rgb = new vec3d_t(isMouseOver ? 0 : 1, 1, 1);
new Box3d(0, 0, 0, 1, 1, 1).DisplayFace(bind); new box3d_t(0, 0, 0, 1, 1, 1).DisplayFace(bind);
bind.PickID = 0; bind.PickID = 0;
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
dst = dst.Expanded(new vec3d_t(0, 0, 0)); dst = dst.Expanded(new vec3d_t(0, 0, 0));
dst = dst.Expanded(new vec3d_t(1, 1, 1)); dst = dst.Expanded(new vec3d_t(1, 1, 1));
+4 -4
View File
@@ -24,20 +24,20 @@ namespace Sample.Disp
{ {
bind.PickID = pickableA.PickingID; bind.PickID = pickableA.PickingID;
bind.Rgb = ColorUtil.GetDiscreteRgb(1); bind.Rgb = ColorUtil.GetDiscreteRgb(1);
new Box3d(0, 0, 0, 1, 1, 1).DisplayFace(bind); new box3d_t(0, 0, 0, 1, 1, 1).DisplayFace(bind);
bind.PickID = pickableB.PickingID; bind.PickID = pickableB.PickingID;
bind.Rgb = ColorUtil.GetDiscreteRgb(2); bind.Rgb = ColorUtil.GetDiscreteRgb(2);
new Box3d(0, 0, 1, 1, 1, 2).DisplayFace(bind); new box3d_t(0, 0, 1, 1, 1, 2).DisplayFace(bind);
bind.PickID = pickableC.PickingID; bind.PickID = pickableC.PickingID;
bind.Rgb = ColorUtil.GetDiscreteRgb(3); bind.Rgb = ColorUtil.GetDiscreteRgb(3);
new Box3d(0, 0, 2, 1, 1, 3).DisplayFace(bind); new box3d_t(0, 0, 2, 1, 1, 3).DisplayFace(bind);
bind.PickID = 0; bind.PickID = 0;
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
dst = dst.Expanded(new vec3d_t(0, 0, 0)); dst = dst.Expanded(new vec3d_t(0, 0, 0));
dst = dst.Expanded(new vec3d_t(1, 1, 3)); dst = dst.Expanded(new vec3d_t(1, 1, 3));
+1 -1
View File
@@ -40,7 +40,7 @@ public class DemoPickable : IDisplayee
draw.Display(bind); draw.Display(bind);
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
draw.ExpandToBox3d(ref dst); draw.ExpandToBox3d(ref dst);
} }
+4 -4
View File
@@ -21,9 +21,9 @@ namespace Sample.Disp
double angle_moon; double angle_moon;
DemoSatellite() DemoSatellite()
{ {
sun = Box3d.CenterUnitBox.ScaledFromCenter(4).ToDraw_Face(); sun = box3d_t.CenterUnitBox.ScaledFromCenter(4).ToDraw_Face();
earth = Box3d.CenterUnitBox.ScaledFromCenter(2).ToDraw_Face(); earth = box3d_t.CenterUnitBox.ScaledFromCenter(2).ToDraw_Face();
moon = Box3d.CenterUnitBox.ToDraw_Face(); moon = box3d_t.CenterUnitBox.ToDraw_Face();
} }
/// <inheritdoc/> /// <inheritdoc/>
public void Display(Bind bind) public void Display(Bind bind)
@@ -41,7 +41,7 @@ namespace Sample.Disp
bind.ModelMatStack.Pop(); bind.ModelMatStack.Pop();
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
dst = dst.Expanded(new vec3d_t(-14, -14, -2)); dst = dst.Expanded(new vec3d_t(-14, -14, -2));
dst = dst.Expanded(new vec3d_t(14, 14, 2)); dst = dst.Expanded(new vec3d_t(14, 14, 2));
+1 -1
View File
@@ -32,7 +32,7 @@ public static class DemoUtil
LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample")); LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample"));
try try
{ {
Box3d box = new Box3d(); box3d_t box = new box3d_t();
displayee.ExpandToBox3d(ref box); displayee.ExpandToBox3d(ref box);
Console.WriteLine($"{title}: {displayee.GetType().Name} bounding {box}"); Console.WriteLine($"{title}: {displayee.GetType().Name} bounding {box}");
Console.WriteLine("Assign it to your canvas' DispEngine.Displayee to see it."); Console.WriteLine("Assign it to your canvas' DispEngine.Displayee to see it.");
+1 -1
View File
@@ -90,7 +90,7 @@ namespace Sample.Disp
bind.ModelMatStack.Pop(); bind.ModelMatStack.Pop();
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
HardNcEnv ncEnv = NcEnv; HardNcEnv ncEnv = NcEnv;
if (ncEnv == null || NcEnv.CncBrand != CncBrand.Heidenhain) if (ncEnv == null || NcEnv.CncBrand != CncBrand.Heidenhain)
+1 -1
View File
@@ -59,7 +59,7 @@ public class IsoCoordinateEntryDisplayee : IAnchoredDisplayee
bind.ModelMatStack.Pop(); bind.ModelMatStack.Pop();
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
HardNcEnv ncEnv = NcEnv; HardNcEnv ncEnv = NcEnv;
if (ncEnv == null) if (ncEnv == null)
+1 -1
View File
@@ -239,7 +239,7 @@ public class MachiningProjectDisplayee : IDisplayee, IGetAnchor
bind.PopColor(); bind.PopColor();
} }
/// <inheritdoc/> /// <inheritdoc/>
public void ExpandToBox3d(ref Box3d dst) public void ExpandToBox3d(ref box3d_t dst)
{ {
//Console.WriteLine($"dst.A: {dst}"); //Console.WriteLine($"dst.A: {dst}");
LocalProjectService?.MachiningEquipment?.GetAsmb()?.ExpandToBox3d(ref dst, LocalProjectService?.MachiningEquipment?.GetAsmb()?.ExpandToBox3d(ref dst,
+1 -1
View File
@@ -22,7 +22,7 @@ public static class DemoBuildGeom
/// <returns>A list of geometries implementing the IGetStl interface</returns> /// <returns>A list of geometries implementing the IGetStl interface</returns>
public static List<IGetStl> GenGeoms() public static List<IGetStl> GenGeoms()
{ {
Box3d box = new Box3d(0, 0, -50, 70, 50, 0); box3d_t box = new box3d_t(0, 0, -50, 70, 50, 0);
Cylindroid cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12), Cylindroid cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
new PairZr(20,16),new PairZr(30,16)]); new PairZr(20,16),new PairZr(30,16)]);
Stl stl = new Stl("geom.stl"); Stl stl = new Stl("geom.stl");
+4 -4
View File
@@ -5,7 +5,7 @@ namespace Sample.Geom;
/// <summary> /// <summary>
/// Demonstrates how to create and calculate bounding boxes for different geometric objects. /// Demonstrates how to create and calculate bounding boxes for different geometric objects.
/// Shows the use of Box3d to encompass multiple geometric elements with a single boundary. /// Shows the use of box3d_t to encompass multiple geometric elements with a single boundary.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// ### Source Code /// ### Source Code
@@ -16,11 +16,11 @@ public static class DemoIExpandToBox3d
static void Main() static void Main()
{ {
#region DocSite.CountBoundingBox #region DocSite.CountBoundingBox
Box3d objA = new Box3d(0, 0, 0, 1, 1, 1); box3d_t objA = new box3d_t(0, 0, 0, 1, 1, 1);
Box3d objB = new Box3d(-1, -2, -3, 3, 2, 1); box3d_t objB = new box3d_t(-1, -2, -3, 3, 2, 1);
vec3d_t objC = new vec3d_t(-2, 3, -5); vec3d_t objC = new vec3d_t(-2, 3, -5);
Box3d boundingbox = new Box3d(objA, objB, objC); box3d_t boundingbox = new box3d_t(objA, objB, objC);
Console.WriteLine("boundingbox: " + boundingbox); Console.WriteLine("boundingbox: " + boundingbox);
#endregion #endregion
} }
@@ -74,7 +74,7 @@ public static class DemoBuildGeomOnlyMachiningProject
//geometry anchor to each mount, so the workpiece mount is placed by the //geometry anchor to each mount, so the workpiece mount is placed by the
//transformer of the branch to it: on top of the 10 mm thick fixture geom. //transformer of the branch to it: on top of the 10 mm thick fixture geom.
Fixture fixture = Fixture.CreateDefault(); Fixture fixture = Fixture.CreateDefault();
fixture.Geom = new Box3d(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10)); fixture.Geom = new box3d_t(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer
= new StaticTranslation(new vec3d_t(0, 0, 10)); = new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture; localProjectService.Fixture = fixture;
@@ -83,7 +83,7 @@ public static class DemoBuildGeomOnlyMachiningProject
//mount and to program zero by zero translations. //mount and to program zero by zero translations.
Workpiece workpiece = Workpiece.CreateDefault(); Workpiece workpiece = Workpiece.CreateDefault();
workpiece.InitResolution = 0.25; workpiece.InitResolution = 0.25;
workpiece.InitGeom = new Box3d(0, 0, -50, 70, 50, 0); workpiece.InitGeom = new box3d_t(0, 0, -50, 70, 50, 0);
workpiece.IdealGeom = null; workpiece.IdealGeom = null;
localProjectService.Workpiece = workpiece; localProjectService.Workpiece = workpiece;
+2 -2
View File
@@ -187,7 +187,7 @@ public static class DemoBuildMachiningProject
//geometry anchor to each mount, so the workpiece mount is placed by the //geometry anchor to each mount, so the workpiece mount is placed by the
//transformer of the branch to it: on top of the 10 mm thick fixture geom. //transformer of the branch to it: on top of the 10 mm thick fixture geom.
Fixture fixture = Fixture.CreateDefault(); Fixture fixture = Fixture.CreateDefault();
fixture.Geom = new Box3d(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10)); fixture.Geom = new box3d_t(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer
= new StaticTranslation(new vec3d_t(0, 0, 10)); = new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture; localProjectService.Fixture = fixture;
@@ -198,7 +198,7 @@ public static class DemoBuildMachiningProject
//mount and to program zero by zero translations. //mount and to program zero by zero translations.
Workpiece workpiece = Workpiece.CreateDefault(); Workpiece workpiece = Workpiece.CreateDefault();
workpiece.InitResolution = 0.25; workpiece.InitResolution = 0.25;
workpiece.InitGeom = new Box3d(0, 0, -50, 70, 50, 0); workpiece.InitGeom = new box3d_t(0, 0, -50, 70, 50, 0);
workpiece.IdealGeom = null; workpiece.IdealGeom = null;
workpiece.CuttingPara = XFactory.GenByFile<ICuttingPara>( workpiece.CuttingPara = XFactory.GenByFile<ICuttingPara>(
"Resource/CuttingParameter", "Al6061T6.default.mp", progress); "Resource/CuttingParameter", "Al6061T6.default.mp", progress);