using Hi.Geom;
using System;
using Hi.Disp;
namespace Sample.Disp
{
///
/// Demonstrates the loading, manipulation, and display of STL (stereolithography) files in HiAPI.
/// Shows operations like loading STL data, transforming geometries, and basic visualization.
///
///
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample.Wpf/Disp/DemoStl.cs)]
///
public static class DemoStl
{
internal static void TransformStl()
{
#region DocSite.TransformStl
Stl stl;
stl = new Stl("Demo/cubic.stl");
//scale the stl to 100x.
stl.Transform(new Mat4d(100));
//create a new stl file.
stl.WriteBin("big_cubic.stl");
stl = new Stl("Demo/cubic.stl");
//move the stl by (100,0,0)
stl.Transform(new Mat4d(new Vec3d(100, 0, 0)));
//create a new stl file.
stl.WriteBin("offset_x100_cubic.stl");
#endregion
}
internal static void DemoCommonUsage()
{
#region DocSite.CommonUsage
Stl stl = new Stl("Disp/cubic.stl");
Box3d bouindingbox = new Box3d(stl);
Console.WriteLine("bouindingbox.Min: " + bouindingbox.Min);
Console.WriteLine("bouindingbox.Max: " + bouindingbox.Max);
Console.WriteLine("bouindingbox.Center: " + bouindingbox.Center);
DispUtil.CallRenderingFrame("DemoForm", stl.ToFaceDrawing());
#endregion
}
static void Main()
{
DemoCommonUsage();
}
}
}