refactor(Hi.Sample)!: Vec3d and Vec2d are named vec3d_t and vec2d_t -- the C++ typedef names, following HiGeom 43fccaf (a word-boundary identifier rename over the 14 demo files the 09-24 rename batch left behind; the repo builds against the HiGeom project reference, so it had stopped compiling)

BREAKING CHANGE: source that names Hi.Geom.Vec3d or Hi.Geom.Vec2d as the vector type must say vec3d_t / vec2d_t.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 10:21:20 +08:00
co-authored by Claude Fable 5.1
parent f4ec31806b
commit 6571576eaa
14 changed files with 44 additions and 44 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ namespace Sample.Disp
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
{
dst.Expand(new Vec3d(0, 0, 0));
dst.Expand(new Vec3d(3, 1, 1));
dst.Expand(new vec3d_t(0, 0, 0));
dst.Expand(new vec3d_t(3, 1, 1));
}
static void Main()
+9 -9
View File
@@ -40,14 +40,14 @@ namespace Sample.Disp
/// </summary>
public static void DrawLines()
{
List<Vec3d> ps;
List<vec3d_t> ps;
double[] vs;
int n = 10; //vertex num
////create drawPoints
ps = new List<Vec3d>(n);
ps = new List<vec3d_t>(n);
for (int i = 0; i < n; i++)
ps.Add(new Vec3d(i, 0, 0));
ps.Add(new vec3d_t(i, 0, 0));
vs = new double[ps.Count * 3];
for (int i = 0; i < ps.Count; i++)
{
@@ -125,8 +125,8 @@ namespace Sample.Disp
for (int i = 0, k = 0; i < n; i++)
{
//the rgb values set as casual.
Vec3d rgb = ColorUtil.GetDiscreteRgb(i);
Tri3d tri = new Tri3d(new Vec3d(i, 0, 0), new Vec3d(i + 1, 0, 0), new Vec3d(i + 0.5, 0, 1));
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));
for (int j = 0; j < 3; j++)
{
vs[k++] = rgb.x;
@@ -146,9 +146,9 @@ namespace Sample.Disp
for (int i = 0, k = 0; i < n; i++)
{
//the rgb values set as casual.
Vec3d rgb = ColorUtil.GetDiscreteRgb(i);
Tri3d tri = new Tri3d(new Vec3d(i, 0, 3), new Vec3d(i + 1, 0, 3), new Vec3d(i + 0.5, 0, 4));
Vec3d nn = tri.GetNormal();
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));
vec3d_t nn = tri.GetNormal();
for (int j = 0; j < 3; j++)
{
vs[k++] = rgb.x;
@@ -180,7 +180,7 @@ namespace Sample.Disp
int n = 10;
List<Tri3d> tris = new List<Tri3d>(n);
for (int i = 0; i < n; i++)
tris.Add(new Tri3d(new Vec3d(i, 0, 0), new Vec3d(i + 1, 0, 0), new Vec3d(i + 0.5, 0, 1)));
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)));
Drawing faceDraw = tris.GetFaceDrawing();
Drawing linesDraw = tris.ToLineDrawing();
+3 -3
View File
@@ -20,15 +20,15 @@ namespace Sample.Disp
public void Display(Bind bind)
{
bind.PickID = PickingID;
bind.Rgb = new Vec3d(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);
bind.PickID = 0;
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
{
dst.Expand(new Vec3d(0, 0, 0));
dst.Expand(new Vec3d(1, 1, 1));
dst.Expand(new vec3d_t(0, 0, 0));
dst.Expand(new vec3d_t(1, 1, 1));
}
/// <inheritdoc/>
public override void OnMouseEnter(ui_event_type e, DispEngine dispEngine)
+2 -2
View File
@@ -39,8 +39,8 @@ namespace Sample.Disp
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
{
dst.Expand(new Vec3d(0, 0, 0));
dst.Expand(new Vec3d(1, 1, 3));
dst.Expand(new vec3d_t(0, 0, 0));
dst.Expand(new vec3d_t(1, 1, 3));
}
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
+6 -6
View File
@@ -30,12 +30,12 @@ namespace Sample.Disp
{
sun.Display(bind);
bind.ModelMatStack.Push();
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new Vec3d(0, 0, 1), angle_earth += 0.03)));
bind.ModelMatStack.Mul(new Mat4d(new Vec3d(12, 0, 0)));
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new vec3d_t(0, 0, 1), angle_earth += 0.03)));
bind.ModelMatStack.Mul(new Mat4d(new vec3d_t(12, 0, 0)));
earth.Display(bind);
bind.ModelMatStack.Push();
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new Vec3d(0, 0, 1), angle_moon += 0.02)));
bind.ModelMatStack.Mul(new Mat4d(new Vec3d(4, 0, 0)));
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new vec3d_t(0, 0, 1), angle_moon += 0.02)));
bind.ModelMatStack.Mul(new Mat4d(new vec3d_t(4, 0, 0)));
moon.Display(bind);
bind.ModelMatStack.Pop();
bind.ModelMatStack.Pop();
@@ -43,8 +43,8 @@ namespace Sample.Disp
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
{
dst.Expand(new Vec3d(-14, -14, -2));
dst.Expand(new Vec3d(14, 14, 2));
dst.Expand(new vec3d_t(-14, -14, -2));
dst.Expand(new vec3d_t(14, 14, 2));
}
static void Main()
+4 -4
View File
@@ -62,10 +62,10 @@ namespace Sample.Disp
////Console.WriteLine($"B: {CoordinateIndex}; {coordinateMove}");
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null
|| !equipment.TryGetMachinePositionAtTableMountZero(out Vec3d mcXyz_AttacherAtTableMountZero))
|| !equipment.TryGetMachinePositionAtTableMountZero(out vec3d_t mcXyz_AttacherAtTableMountZero))
return;
Vec3d coordinateMove;
vec3d_t coordinateMove;
string text;
if (HeidenhainCycleDef247Q339 == 0 && HeidenhainCycleDef7Arg == null)
return;
@@ -98,9 +98,9 @@ namespace Sample.Disp
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null
|| !equipment.TryGetMachinePositionAtTableMountZero(out Vec3d mcXyz_AttacherAtTableMountZero))
|| !equipment.TryGetMachinePositionAtTableMountZero(out vec3d_t mcXyz_AttacherAtTableMountZero))
return;
Vec3d coordinateMove;
vec3d_t coordinateMove;
if (HeidenhainCycleDef247Q339 == 0 && HeidenhainCycleDef7Arg == null)
return;
coordinateMove = NcFlagUtil.GetHeidenhainCoordinateOffset(
+4 -4
View File
@@ -45,12 +45,12 @@ public class IsoCoordinateEntryDisplayee : IAnchoredDisplayee
if (ncEnv == null)
return;
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out Vec3d coordinateMove) != true)
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out vec3d_t coordinateMove) != true)
return;
string text = IsoCoordinateId ?? "";
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out Vec3d attacherPos))
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out vec3d_t attacherPos))
return;
bind.ModelMatStack.Push();
@@ -64,11 +64,11 @@ public class IsoCoordinateEntryDisplayee : IAnchoredDisplayee
HardNcEnv ncEnv = NcEnv;
if (ncEnv == null)
return;
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out Vec3d coordinateMove) != true)
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out vec3d_t coordinateMove) != true)
return;
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out Vec3d attacherPos))
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out vec3d_t attacherPos))
return;
dst.Expand(attacherPos);
}
+2 -2
View File
@@ -30,8 +30,8 @@ public static class DemoBuildGeom
TransformationGeom transformationGeom = new TransformationGeom()
{
Transformer = new GeneralTransform(1,
new StaticRotation(new Vec3d(0, 0, 1), MathUtil.ToRad(15), new Vec3d(0, 0, 0)),
new StaticTranslation(new Vec3d(0, 0, 0))),
new StaticRotation(new vec3d_t(0, 0, 1), MathUtil.ToRad(15), new vec3d_t(0, 0, 0)),
new StaticTranslation(new vec3d_t(0, 0, 0))),
Geom = stl
};
GeomCombination geomCombination = new GeomCombination(stlFile, transformationGeom);
+1 -1
View File
@@ -18,7 +18,7 @@ public static class DemoIExpandToBox3d
#region DocSite.CountBoundingBox
Box3d objA = new Box3d(0, 0, 0, 1, 1, 1);
Box3d objB = new Box3d(-1, -2, -3, 3, 2, 1);
Vec3d objC = new Vec3d(-2, 3, -5);
vec3d_t objC = new vec3d_t(-2, 3, -5);
Box3d boundingbox = new Box3d(objA, objB, objC);
Console.WriteLine("boundingbox: " + boundingbox);
+2 -2
View File
@@ -42,8 +42,8 @@ namespace Sample.MachineTool
GeneralXyzabcMachineTool dst = GeneralXyzabcMachineTool.CreateFromChainCode(
"[O][Y][X][C][w];[O][Z][B][S][t]");
if (dst.ToolMountTransformer is StaticTranslation st)
st.Trans = new Vec3d(-72.40, 72.40, 176.44);
dst.TransformerB.Pivot = new Vec3d(-72.4, -177.4, 225.94);
st.Trans = new vec3d_t(-72.40, 72.40, 176.44);
dst.TransformerB.Pivot = new vec3d_t(-72.4, -177.4, 225.94);
Dictionary<string, Solid> solidMap = new Dictionary<string, Solid>()
{
["O"] = new Solid(new Stl("MachineTool/base.stl")),
@@ -23,7 +23,7 @@ public static class DemoBuildMachineToolWithoutGeometrys
GeneralXyzabcMachineTool xyzabcMachineTool = GeneralXyzabcMachineTool.CreateFromChainCode(
"[O][C][w];[O][X][Y][Z][B][S][t]");
if (xyzabcMachineTool.ToolMountTransformer is StaticTranslation st)
st.Trans = new Vec3d(-200, 200, 400);
st.Trans = new vec3d_t(-200, 200, 400);
return xyzabcMachineTool;
}
}
@@ -74,9 +74,9 @@ public static class DemoBuildGeomOnlyMachiningProject
//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.
Fixture fixture = Fixture.CreateDefault();
fixture.Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10));
fixture.Geom = new Box3d(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer
= new StaticTranslation(new Vec3d(0, 0, 10));
= new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture;
//The default shape already leads from the geometry anchor to the fixture
+2 -2
View File
@@ -187,9 +187,9 @@ public static class DemoBuildMachiningProject
//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.
Fixture fixture = Fixture.CreateDefault();
fixture.Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10));
fixture.Geom = new Box3d(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer
= new StaticTranslation(new Vec3d(0, 0, 10));
= new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture;
#endregion
+4 -4
View File
@@ -33,10 +33,10 @@ public static class DemoTopo1
Anchor B = new Anchor(asmb, "B");
//build kinematic link
Branch.Attach(O, O1, new StaticTranslation(new Vec3d(0, 0, 80)));
Branch brnX = Branch.Attach(O1, X, new DynamicTranslation(new Vec3d(1, 0, 0)));
Branch brnZ = Branch.Attach(X, Z, new DynamicTranslation(new Vec3d(0, 0, 1)));
Branch brnB = Branch.Attach(Z, B, new DynamicRotation(new Vec3d(0, 1, 0), 0, new Vec3d(-100, 0, 0)));
Branch.Attach(O, O1, new StaticTranslation(new vec3d_t(0, 0, 80)));
Branch brnX = Branch.Attach(O1, X, new DynamicTranslation(new vec3d_t(1, 0, 0)));
Branch brnZ = Branch.Attach(X, Z, new DynamicTranslation(new vec3d_t(0, 0, 1)));
Branch brnB = Branch.Attach(Z, B, new DynamicRotation(new vec3d_t(0, 1, 0), 0, new vec3d_t(-100, 0, 0)));
//drive the dynamic transformation by single value for each branch.
brnX.Step = 200;