This commit is contained in:
2025-07-18 15:38:28 +08:00
parent aabaf90482
commit 38b27cd481
2003 changed files with 683103 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@@ -0,0 +1,145 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Kinematic Topology | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Kinematic Topology | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../../toc.html">
<meta name="docfx:tocrel" content="../../../toc.html">
<meta name="docfx:rel" content="../../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../../index.html">
<img id="logo" class="svg" src="../../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Usage.HiMech.Topo">
<h1 id="kinematic-topology">Kinematic Topology</h1>
<p>The Kinematic Topology is composed of three elemental classes: <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a></strong>, <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.Branch.html">Branch</a></strong> and <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a></strong>.</p>
<h2 id="basic-elements">Basic Elements</h2>
<h3 id="anchors-and-branches">Anchors and Branches</h3>
<p><strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a></strong> object contains a cartesian coordinate. It can be a mechanical component or a flag.</p>
<p><strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.Branch.html">Branch</a></strong> object is a directional link between two <a class="xref" href="../../../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a> objects. It contains the <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a></strong> object. The <a class="xref" href="../../../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a> object contains a coordinate <strong>transformation matrix</strong>. As shown in the following sketch:</p>
<p><img src="chainLink.png" alt="Chain Structure"></p>
<h3 id="assembly-management">Assembly Management</h3>
<p><strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a></strong> (Assembly) provides organization and management of Anchors. An Assembly can contain both Anchors and other Assemblies. Key features include:</p>
<ul>
<li>Grouping related Anchors together</li>
<li>Managing coordinate transformations</li>
<li>Providing display and indexing functions</li>
<li>Supporting hierarchical structure</li>
</ul>
<h2 id="kinematic-chain-example">Kinematic Chain Example</h2>
<p>The following figure shows a kinematic chain of a non-orthogonal 5-axis machine tool:</p>
<p><img src="vmt.png" alt="VMT Structure"></p>
<p>Each <a class="xref" href="../../../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a> represents a component:</p>
<ul>
<li>Axis components: X, Y, Z, B, C</li>
<li>Base components: O (base1), O* (base2)</li>
<li>Tool components: S (spindle), T (tool body), T* (tool flute)</li>
<li>Workpiece: W</li>
</ul>
<p>The relative transform between two Anchors is calculated by multiplying the transform matrices along the Branch. For example, the transform matrix from W to T is:</p>
<div class="math">
\[
M_{WT} = M_{CW}^{-1} \cdot M_{YC}^{-1} \cdot M_{OY}^{-1} \cdot M_{OO^*} \cdot M_{O^*X} \cdot M_{XZ} \cdot M_{ZB} \cdot M_{BS} \cdot M_{ST}
\]</div>
<p>This matrix can be obtained using <a class="xref" href="../../../../../api/Hi.Mech.Topo.Asmb.html#Hi_Mech_Topo_Asmb_GetMat4d_Hi_Mech_Topo_IGetAnchor_Hi_Mech_Topo_IGetAnchor_">GetMat4d(IGetAnchor, IGetAnchor)</a>.</p>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HiAPI Mechanics Overview | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="HiAPI Mechanics Overview | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../toc.html">
<meta name="docfx:tocrel" content="../../toc.html">
<meta name="docfx:rel" content="../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../index.html">
<img id="logo" class="svg" src="../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="HiMech.Overview">
<h1 id="mechanism-topology">Mechanism Topology</h1>
<p>HiAPI Mechanism Topology provides basic functionality for assembling mechanical structures and simulating their motions. It allows you to build kinematic models of milling machines and similar mechanical structures through a topology-based approach.</p>
<h2 id="core-concepts">Core Concepts</h2>
<h3 id="kinematic-topology">Kinematic Topology</h3>
<p>Kinematic Topology is the core concept of this module, which describes the motion relationships between mechanical components. With Kinematic Topology, you can:</p>
<ul>
<li>Define mechanical structures and motion relationships</li>
<li>Calculate forward and inverse kinematics</li>
<li>Display component positions and orientations</li>
<li>Conduct collision detection</li>
</ul>
<h3 id="main-modules">Main Modules</h3>
<ul>
<li><a href="Topo/index.html">Topology</a> - Kinematic topology structure, including assembly management and chain definition</li>
<li><a href="transformers/index.html">Transformers</a> - Coordinate transformation and motion transformation</li>
</ul>
<h2 id="api-references">API References</h2>
<ul>
<li><a class="xref" href="../../../../api/Hi.Mech.Topo.html">Hi.Mech.Topo</a> - Core topology functionality</li>
<li><a class="xref" href="../../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a> - Assembly-related functionality</li>
<li><a class="xref" href="../../../../api/Hi.Mech.Topo.Branch.html">Branch</a> - Chain-related functionality</li>
</ul>
<h2 id="examples">Examples</h2>
<p>Please refer to the examples in each sub-section to learn how to use these features to build your applications.</p>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,198 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Handle Transform Matrix by ITransformer | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Handle Transform Matrix by ITransformer | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../../toc.html">
<meta name="docfx:tocrel" content="../../../toc.html">
<meta name="docfx:rel" content="../../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../../index.html">
<img id="logo" class="svg" src="../../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="HiMech.Tutor.transformers">
<h1 id="handle-transform-matrix-by-itransformer">Handle Transform Matrix by ITransformer</h1>
<p><strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a></strong> contains a transform matrix and a inverse transform matrix. The matrix is 4x4 column-major matrix, which describe the orientation or movement between 3D coordinates.</p>
<p>Several common used interface and class are implemented from <a class="xref" href="../../../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a>. The inheritance is shown:</p>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.IStaticTransformer.html">IStaticTransformer</a>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.NoTransform.html">NoTransform</a></li>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a></li>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a></li>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticFreeform.html">StaticFreeform</a></li>
</ul>
</li>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.IDynamicTransformer.html">IDynamicTransformer</a>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.IDynamicRegular.html">IDynamicRegular</a>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.DynamicTranslation.html">DynamicTranslation</a></li>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.DynamicRotation.html">DynamicRotation</a></li>
</ul>
</li>
<li><a class="xref" href="../../../../../api/Hi.Mech.Topo.DynamicFreeform.html">DynamicFreeform</a></li>
</ul>
</li>
</ul>
<p><strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.IStaticTransformer.html">IStaticTransformer</a></strong> is transformer with constant matrix. <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.NoTransform.html">NoTransform</a></strong>, <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a></strong> and <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a></strong> contains transform matrix of identity, translate and rotate respectively. <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticFreeform.html">StaticFreeform</a></strong> contains a arbitrary constant transform matrix.</p>
<p>The transform matrix of <a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a> is:</p>
<div class="math">
\[
M_{StaticTranslate}=
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
Trans.x &amp; Trans.y &amp; Trans.z &amp; 1
\end{bmatrix}
\]</div>
<p>The transform matrix of <a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a> and <a class="xref" href="../../../../../api/Hi.Mech.Topo.DynamicRotation.html">DynamicRotation</a> is:</p>
<div class="math">
\[
M_{Rotate}=
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
-Pivot.x &amp; -Pivot.y &amp; -Pivot.z &amp; 1
\end{bmatrix}
\cdot
\\\\
\begin{bmatrix}
Rot_{00}(axis,rad) &amp; Rot_{01}(axis,rad) &amp; Rot_{02}(axis,rad) &amp; 0 \\\\
Rot_{10}(axis,rad) &amp; Rot_{11}(axis,rad) &amp; Rot_{12}(axis,rad) &amp; 0 \\\\
Rot_{20}(axis,rad) &amp; Rot_{21}(axis,rad) &amp; Rot_{22}(axis,rad) &amp; 0 \\\\
0 &amp; 0 &amp; 0 &amp; 1
\end{bmatrix}
\cdot
\\\\
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
Pivot.x &amp; Pivot.y &amp; Pivot.z &amp; 1
\end{bmatrix}
\]</div>
<p>Where <a class="xref" href="../../../../../api/Hi.Mech.Topo.DynamicRotation.html#Hi_Mech_Topo_DynamicRotation_Pivot">Pivot</a> is the position of the rotation axis.</p>
<div class="TIP">
<h5>Tip</h5>
<p>Pivot is a point. However, rotation axis is a line. It means that it causes the same matrix no matter how the pivot is moving along the axis.</p>
</div>
<p><strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.IDynamicTransformer.html">IDynamicTransformer</a></strong> is transformer with inconstant transform matrix. <strong><a class="xref" href="../../../../../api/Hi.Mech.Topo.IDynamicRegular.html">IDynamicRegular</a></strong> has a property <a class="xref" href="../../../../../api/Hi.Mech.Topo.IDynamicRegular.html#Hi_Mech_Topo_IDynamicRegular_Step">Step</a>, implied that the transform matrix is one parameter driven. <a class="xref" href="../../../../../api/Hi.Mech.Topo.TransformerUtil.html#Hi_Mech_Topo_TransformerUtil_GetSteps_Hi_Mech_Topo_IDynamicRegular___">GetSteps(IDynamicRegular[])</a> and <a class="xref" href="../../../../../api/Hi.Mech.Topo.TransformerUtil.html#Hi_Mech_Topo_TransformerUtil_SetSteps_Hi_Mech_Topo_IDynamicRegular___System_Double___">SetSteps(IDynamicRegular[], double[])</a> provide easy handle of an array of <a class="xref" href="../../../../../api/Hi.Mech.Topo.IDynamicRegular.html">IDynamicRegular</a> objects.</p>
<p>The transform matrix of <a class="xref" href="../../../../../api/Hi.Mech.Topo.DynamicTranslation.html">DynamicTranslation</a> is:</p>
<div class="math">
\[
M_{DynamicTranslate}=
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
Trans.x \cdot Step &amp; Trans.y \cdot Step &amp; Trans.z \cdot Step &amp; 1
\end{bmatrix}
\]</div>
<div class="NOTE">
<h5>Note</h5>
<p>In convention, <a class="xref" href="../../../../../api/Hi.Mech.Topo.StaticTranslation.html#Hi_Mech_Topo_StaticTranslation_Trans">Trans</a> should be normalized.</p>
</div>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

@@ -0,0 +1,300 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Using Hi.Disp.Drawing | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Using Hi.Disp.Drawing | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../../toc.html">
<meta name="docfx:tocrel" content="../../../toc.html">
<meta name="docfx:rel" content="../../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../../index.html">
<img id="logo" class="svg" src="../../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="using-hidispdrawing">Using Hi.Disp.Drawing</h1>
<p>The <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a> class is the most fundamental and efficient rendering unit that allows you to draw points, lines, and surfaces within the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a>.</p>
<h2 id="understanding-drawing-structure">Understanding Drawing Structure</h2>
<p>Looking at the constructor <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html#Hi_Disp_Drawing__ctor_System_Double___Hi_Disp_Stamp_System_Int32_">Drawing(double[], Stamp, int)</a> helps explain its structure:</p>
<ul>
<li>The <code>double[]</code> array contains batch data for rendering, composed of one or more data groups of consistent length</li>
<li>Each data group's length is determined by the <a class="xref" href="../../../../../api/Hi.Disp.Stamp.html">Stamp</a> parameter</li>
<li>Each data group describes a single vertex</li>
</ul>
<h2 id="data-components">Data Components</h2>
<p>A data group can contain up to four types of information:</p>
<table>
<thead>
<tr>
<th>Information</th>
<th>Abbreviation</th>
<th>Description</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Vertex</strong></td>
<td>V</td>
<td>The position of the point (x, y, z)</td>
<td>3 doubles</td>
</tr>
<tr>
<td><strong>Normal</strong></td>
<td>N</td>
<td>The normal vector affecting light reflection (Nx, Ny, Nz)</td>
<td>3 doubles</td>
</tr>
<tr>
<td><strong>Color</strong></td>
<td>C</td>
<td>RGB color values ranging from 0 to 1</td>
<td>3 doubles</td>
</tr>
<tr>
<td><strong>Pick ID</strong></td>
<td>P</td>
<td>A single double value converted from an integer for selection operations</td>
<td>1 double</td>
</tr>
</tbody>
</table>
<p>The <a class="xref" href="../../../../../api/Hi.Disp.Stamp.html">Stamp</a> enumeration combines these abbreviations to create these possible stamps: <code>{V, NV, CV, CNV, PV, PNV, PCV, PCNV}</code>.</p>
<h3 id="important-notes">Important Notes:</h3>
<ul>
<li>The <strong>Vertex</strong> (V) is mandatory, which is why V appears in every Stamp option</li>
<li><strong>Normal</strong> vectors (N) are typically used for 3D graphics to create a sense of depth through lighting</li>
<li><strong>Color</strong> (C) uses three double values (R, G, B) in the range of 0 to 1</li>
<li><strong>Pick ID</strong> (P) is used for graphical selection operations</li>
</ul>
<h2 id="data-structure-example">Data Structure Example</h2>
<ul>
<li>If <a class="xref" href="../../../../../api/Hi.Disp.Stamp.html">Stamp</a> is <code>V</code>, each data group consists of 3 double values (x, y, z)</li>
<li>If <a class="xref" href="../../../../../api/Hi.Disp.Stamp.html">Stamp</a> is <code>PCV</code>, each data group consists of 1(P) + 3(C) + 3(V) = 7 double values</li>
</ul>
<h2 id="rendering-mode">Rendering Mode</h2>
<p>The <code>glmode</code> parameter is an OpenGL constant that specifies the drawing mode. You can search for &ldquo;OpenGL Primitives&rdquo; online to see illustrations of these modes.</p>
<h2 id="example-usage">Example Usage</h2>
<pre><code class="lang-csharp">// Creating a simple line strip with three vertices
double[] vertices = new double[] {
0, 0, 0, // First point at origin
1, 0, 0, // Second point along X-axis
0, 0, 1 // Third point along Z-axis
};
// Create drawing object using the vertices
var drawing = new Drawing(vertices, Stamp.V, (int)OpenGL.GL_LINE_STRIP);
</code></pre>
<p>This example creates three vertices with only position information (V), so each vertex has just xyz coordinates. The drawing mode is set to LineStrip.</p>
<p><img src="easydraw_lines.png" alt="Line Strip Drawing Example"></p>
<h2 id="performance-considerations">Performance Considerations</h2>
<div class="NOTE">
<h5>Note</h5>
<p>After a <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a> object is created, its source data is stored in GPU memory. Regardless of the amount of data, the CPU processing load when calling <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html#Hi_Disp_IDisplayee_Display_Hi_Disp_Bind_">Display(Bind)</a> remains consistent. This means displaying 100 points with one <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a> object is approximately 100 times faster than using 100 separate Drawing objects to display 100 individual points.</p>
</div>
<h2 id="composing-multiple-idisplayee-objects">Composing Multiple IDisplayee Objects</h2>
<p>A common pattern is to combine multiple <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> objects, including <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a> objects:</p>
<pre><code class="lang-csharp">public class MyCompositeDisplayee : IDisplayee
{
private readonly List&lt;IDisplayee&gt; _displayees = new List&lt;IDisplayee&gt;();
public MyCompositeDisplayee()
{
// Create a grid drawing
_displayees.Add(CreateGridDrawing());
// Create an axes drawing
_displayees.Add(CreateAxesDrawing());
// Add other custom drawings
_displayees.Add(CreateCustomDrawing());
}
private Drawing CreateGridDrawing()
{
// Code to create a grid
double[] gridVertices = new double[/* grid data */];
return new Drawing(gridVertices, Stamp.CV, (int)OpenGL.GL_LINES);
}
private Drawing CreateAxesDrawing()
{
// Create colored axes
double[] axesData = new double[] {
// Red X-axis (with color)
1, 0, 0, 0, 0, 0, // Red color, origin
1, 0, 0, 1, 0, 0, // Red color, x-axis end
// Green Y-axis (with color)
0, 1, 0, 0, 0, 0, // Green color, origin
0, 1, 0, 0, 1, 0, // Green color, y-axis end
// Blue Z-axis (with color)
0, 0, 1, 0, 0, 0, // Blue color, origin
0, 0, 1, 0, 0, 1 // Blue color, z-axis end
};
return new Drawing(axesData, Stamp.CV, (int)OpenGL.GL_LINES);
}
public void Display(Bind bind)
{
// Render all contained displayees
foreach (var displayee in _displayees)
{
displayee.Display(bind);
}
}
public void ExpandToBox3d(Box3d box)
{
// Update bounding box based on all displayees
foreach (var displayee in _displayees)
{
displayee.ExpandToBox3d(box);
}
}
}
</code></pre>
<h2 id="creating-common-shapes">Creating Common Shapes</h2>
<p>Here are some examples of creating common shapes using the <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a> class:</p>
<h3 id="creating-points">Creating Points</h3>
<pre><code class="lang-csharp">// Create an array of points
double[] pointData = new double[] {
0, 0, 0, // Point 1
1, 1, 1, // Point 2
2, 0, 0, // Point 3
0, 2, 0 // Point 4
};
// Create a Drawing for points
var pointDrawing = new Drawing(pointData, Stamp.V, (int)OpenGL.GL_POINTS);
</code></pre>
<h3 id="creating-lines">Creating Lines</h3>
<pre><code class="lang-csharp">// Create line segments (pairs of vertices)
double[] lineData = new double[] {
0, 0, 0, 1, 1, 0, // Line 1: (0,0,0) to (1,1,0)
2, 0, 0, 2, 2, 0 // Line 2: (2,0,0) to (2,2,0)
};
// Create a Drawing for lines
var lineDrawing = new Drawing(lineData, Stamp.V, (int)OpenGL.GL_LINES);
</code></pre>
<h3 id="creating-triangles">Creating Triangles</h3>
<pre><code class="lang-csharp">// Create triangles (triplets of vertices)
double[] triangleData = new double[] {
// Triangle 1
0, 0, 0, // Vertex 1
1, 0, 0, // Vertex 2
0, 1, 0 // Vertex 3
};
// Create a Drawing for triangles
var triangleDrawing = new Drawing(triangleData, Stamp.V, (int)OpenGL.GL_TRIANGLES);
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../../../api/Hi.Disp.DispList.html">DispList</a></li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,171 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rendering with HiAPI | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Rendering with HiAPI | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../toc.html">
<meta name="docfx:tocrel" content="../../toc.html">
<meta name="docfx:rel" content="../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../index.html">
<img id="logo" class="svg" src="../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="rendering-with-hiapi">Rendering with HiAPI</h1>
<p>This section covers the rendering capabilities of HiAPI, focusing on how to create and display visual content in your applications.</p>
<h2 id="overview">Overview</h2>
<p>HiAPI provides a powerful rendering system built around the <a class="xref" href="../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> and <a class="xref" href="../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> interface. This system enables you to:</p>
<ul>
<li>Create and render 3D and 2D graphics</li>
<li>Implement interactive user interfaces</li>
<li>Achieve high-performance rendering across multiple platforms</li>
<li>Handle touch, mouse, and keyboard input uniformly</li>
</ul>
<h2 id="key-components">Key Components</h2>
<p>The HiAPI rendering system consists of several key components:</p>
<ul>
<li><strong>DispEngine</strong>: The core rendering engine that processes displayees and handles user interaction</li>
<li><strong>IDisplayee</strong>: The interface for renderable objects</li>
<li><strong>Drawing</strong>: A fundamental rendering unit for creating basic geometric elements</li>
<li><strong>RenderingCanvas</strong>: UI controls for different frameworks that host the DispEngine</li>
</ul>
<h2 id="sections">Sections</h2>
<table>
<thead>
<tr>
<th>Topic</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="rendering-canvas/index.html">Using RenderingCanvas with DispEngine</a></td>
<td>Learn how to use the RenderingCanvas component in your applications</td>
</tr>
<tr>
<td><a href="rendering-canvas/custom-implementation.html">Building Your Own Rendering Canvas</a></td>
<td>Understand how to implement custom rendering components</td>
</tr>
<tr>
<td><a href="drawing/index.html">Drawing</a></td>
<td>Learn how to use the Drawing class to create basic geometric elements</td>
</tr>
</tbody>
</table>
<h2 id="basic-rendering-workflow">Basic Rendering Workflow</h2>
<p>The typical workflow for rendering with HiAPI follows these steps:</p>
<ol>
<li><strong>Create Displayees</strong>: Implement <a class="xref" href="../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> or use existing implementations like <a class="xref" href="../../../../api/Hi.Disp.Drawing.html">Drawing</a></li>
<li><strong>Configure DispEngine</strong>: Create and initialize a <a class="xref" href="../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> with your displayees</li>
<li><strong>UI Integration</strong>: Use RenderingCanvas components to display the rendered content in your UI</li>
<li><strong>Handle Input</strong>: Process user interactions through the DispEngine's input handling methods</li>
</ol>
<p>This pattern works consistently across all supported UI frameworks, allowing you to develop cross-platform applications with a unified codebase.</p>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../../api/Hi.Disp.Drawing.html">Drawing</a></li>
<li><a class="xref" href="../../../../api/Hi.Disp.DispList.html">DispList</a></li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,850 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building Your Own Rendering Canvas | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Building Your Own Rendering Canvas | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../../toc.html">
<meta name="docfx:tocrel" content="../../../toc.html">
<meta name="docfx:rel" content="../../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../../index.html">
<img id="logo" class="svg" src="../../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="building-your-own-rendering-canvas">Building Your Own Rendering Canvas</h1>
<p>This guide provides detailed implementation information for creating your own <code>RenderingCanvas</code> using the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a>. By understanding these implementation details, you can customize the rendering component for specific application needs or create implementations for other UI frameworks.</p>
<div class="NOTE">
<h5>Note</h5>
<p><strong>For Windows Applications</strong>: If you are developing for Windows systems, it is recommended to directly use the existing <code>RenderingCanvas</code> implementations in the <code>Hi.WinForm</code> or <code>Hi.Wpf</code> packages, rather than creating your own. These implementations are fully tested, optimized, and maintained.</p>
<p>The implementation details provided in this document are primarily for educational purposes or for developers who need to port RenderingCanvas to other platforms/frameworks.</p>
</div>
<h2 id="basic-dispengine-usage">Basic DispEngine Usage</h2>
<p>The <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> is designed to display objects that implement the <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> interface. This is the fundamental purpose of DispEngine - to render displayable objects.</p>
<h3 id="idisplayee-implementation">IDisplayee Implementation</h3>
<p>To create renderable content, implement the <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> interface:</p>
<pre><code class="lang-csharp">public class MyCustomDisplayee : IDisplayee
{
public void Display(Bind bind)
{
// Drawing code using the bind object
}
public void ExpandToBox3d(Box3d box)
{
// Update bounding box for view calculations
}
}
</code></pre>
<h3 id="using-displayees-with-dispengine">Using Displayees with DispEngine</h3>
<p>There are multiple ways to provide displayees to a DispEngine:</p>
<pre><code class="lang-csharp">// Create DispEngine with a single displayee
var engine = new DispEngine(myDisplayee);
// Create DispEngine with multiple displayees
var engine = new DispEngine(displayee1, displayee2, displayee3);
// Change the displayee after creation
engine.Displayee = newDisplayee;
// Use DispList to group multiple displayees
var displayList = new DispList(displayee1, displayee2);
engine.Displayee = displayList;
</code></pre>
<h2 id="core-implementation-pattern">Core Implementation Pattern</h2>
<p>When implementing a custom <code>RenderingCanvas</code> for a UI platform, follow these key steps:</p>
<ol>
<li><strong>Initialize UI Component</strong> - Set up the UI control properties and event handling</li>
<li><strong>Configure DispEngine</strong> - Create and properly initialize the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> instance</li>
<li><strong>Set Up Rendering Pipeline</strong> - Implement buffer swapping mechanism for visualization</li>
<li><strong>Handle User Input</strong> - Map platform-specific input events to DispEngine methods</li>
<li><strong>Manage Component Lifecycle</strong> - Ensure proper resource management and cleanup</li>
</ol>
<p>Let's examine the actual implementations in WinForm and WPF frameworks to understand these patterns in practice.</p>
<h2 id="winform-implementation-details">WinForm Implementation Details</h2>
<p>The WinForm implementation in <code>Hi.WinForm</code> combines Windows Forms controls with the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> rendering system.</p>
<h3 id="core-properties-and-fields">Core Properties and Fields</h3>
<p>Here are the essential properties and fields defined in the WinForm implementation:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// &lt;see cref=&quot;DispEngine&quot;/&gt;.
/// &lt;/summary&gt;
public DispEngine DispEngine { get; }
// Constants and structures for WM_TOUCH
private const int WM_TOUCH = 0x0240;
private const int TOUCHEVENTF_MOVE = 0x0001;
private const int TOUCHEVENTF_DOWN = 0x0002;
private const int TOUCHEVENTF_UP = 0x0004;
[StructLayout(LayoutKind.Sequential)]
private struct TOUCHINPUT
{
public int x;
public int y;
public IntPtr hSource;
public int dwID;
public int dwFlags;
public int dwMask;
public int dwTime;
public IntPtr dwExtraInfo;
public int cxContact;
public int cyContact;
}
[DllImport(&quot;user32.dll&quot;)]
private static extern bool RegisterTouchWindow(IntPtr hWnd, uint ulFlags);
[DllImport(&quot;user32.dll&quot;)]
private static extern bool GetTouchInputInfo(IntPtr hTouchInput, int cInputs, [In, Out] TOUCHINPUT[] pInputs, int cbSize);
[DllImport(&quot;user32.dll&quot;)]
private static extern void CloseTouchInputHandle(IntPtr lParam);
</code></pre><h3 id="initialization">Initialization</h3>
<p>The initialization code sets up event handlers and creates the DispEngine:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Ctor.
/// &lt;/summary&gt;
/// &lt;param name=&quot;displayees&quot;&gt;displayees&lt;/param&gt;
public unsafe RenderingCanvas(params IDisplayee[] displayees)
{
// Configure the control's visual styles
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
SetStyle(ControlStyles.ContainerControl, false);
SetStyle(ControlStyles.ResizeRedraw, false);
DoubleBuffered = true;
InitializeComponent();
Dock = DockStyle.Fill;
// Connect event handlers for user input and window events
this.Resize += RenderingCanvas_Resize;
this.VisibleChanged += RenderingCanvas_VisibleChanged;
this.MouseMove += RenderingCanvas_MouseMove;
this.MouseDown += RenderingCanvas_MouseDown;
this.MouseUp += RenderingCanvas_MouseUp;
this.MouseWheel += RenderingCanvas_MouseWheel;
this.KeyDown += RenderingCanvas_KeyDown;
this.KeyUp += RenderingCanvas_KeyUp;
// Add focus event handler
this.GotFocus += RenderingCanvas_GotFocus;
this.HandleCreated += OnHandleCreated;
// Enable touch input and click events for the control
this.SetStyle(ControlStyles.StandardClick, true);
this.SetStyle(ControlStyles.StandardDoubleClick, true);
this.TabStop = true;
// Initialize the DispEngine with provided displayees
DispEngine = new DispEngine(displayees);
DispEngine.BackgroundColor = new Vec3d(0.1, 0.1, 0.5);
DispEngine.BackgroundOpacity = 0.1;
DispEngine.SetViewToHomeView();
DispEngine.ImageRequestAfterBufferSwapped += DispEngine_ImageRequestAfterBufferSwapped;
// Set initial size and start the rendering engine
this.Size = new System.Drawing.Size(500, 300);
DispEngine.Start(this.ClientSize.Width, this.ClientSize.Height);
}
</code></pre><h3 id="rendering-pipeline">Rendering Pipeline</h3>
<p>The rendering pipeline processes images from DispEngine and displays them:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">private unsafe void DispEngine_ImageRequestAfterBufferSwapped(byte* bgra_unsignedbyte_pixels, int w, int h)
{
// Create a bitmap from the raw pixel data provided by DispEngine
Bitmap bitmap;
bitmap = new Bitmap(new Bitmap(w, h, w * 4,
PixelFormat.Format32bppArgb, new IntPtr(bgra_unsignedbyte_pixels)));
// Update the background image and dispose the previous one
Image pre = this.BackgroundImage;
this.BackgroundImage = bitmap;
pre?.Dispose();
}
</code></pre><h3 id="input-handling">Input Handling</h3>
<h4 id="windows-message-handling-for-touch">Windows Message Handling for Touch</h4>
<p>WinForm implementation intercepts Windows touch messages and forwards them to DispEngine:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">protected override void WndProc(ref Message m)
{
if (m.Msg == WM_TOUCH)
{
HandleTouchInput(m.WParam, m.LParam);
return;
}
base.WndProc(ref m);
}
private void OnHandleCreated(object sender, EventArgs e)
{
// Register window to receive touch messages
RegisterTouchWindow(this.Handle, 0);
}
private void HandleTouchInput(IntPtr wParam, IntPtr lParam)
{
int inputCount = wParam.ToInt32();
TOUCHINPUT[] inputs = new TOUCHINPUT[inputCount];
if (!GetTouchInputInfo(lParam, inputCount, inputs, Marshal.SizeOf(typeof(TOUCHINPUT))))
return;
try
{
for (int i = 0; i &lt; inputCount; i++)
{
TOUCHINPUT ti = inputs[i];
int touchId = ti.dwID;
// Convert touch coordinates to client coordinates
Point touchPoint = PointToClient(new Point(ti.x / 100, ti.y / 100));
if ((ti.dwFlags &amp; TOUCHEVENTF_DOWN) != 0)
{
// Touch down event
DispEngine.TouchDown(touchId, touchPoint.X, touchPoint.Y);
this.Focus();
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_MOVE) != 0)
{
// Touch move event
DispEngine.TouchMove(touchId, touchPoint.X, touchPoint.Y);
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_UP) != 0)
{
// Touch up event
DispEngine.TouchUp(touchId);
}
}
}
finally
{
CloseTouchInputHandle(lParam);
}
}
</code></pre>
<p>The key aspect is mapping Windows touch events to DispEngine's touch API:</p>
<pre><code class="lang-csharp">// Inside HandleTouchInput method
if ((ti.dwFlags &amp; TOUCHEVENTF_DOWN) != 0)
{
// Touch down event - delegate to DispEngine
DispEngine.TouchDown(touchId, touchPoint.X, touchPoint.Y);
this.Focus();
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_MOVE) != 0)
{
// Touch move event - delegate to DispEngine
DispEngine.TouchMove(touchId, touchPoint.X, touchPoint.Y);
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_UP) != 0)
{
// Touch up event - delegate to DispEngine
DispEngine.TouchUp(touchId);
}
</code></pre>
<h4 id="mouse-events">Mouse Events</h4>
<pre><code class="lang-csharp" name="RenderingCanvas">private void RenderingCanvas_MouseMove(object sender, MouseEventArgs e)
{
// Update mouse position and handle drag transforms
DispEngine.MouseMove(e.Location.X, e.Location.Y);
DispEngine.MouseDragTransform(e.Location.X, e.Location.Y,
new mouse_button_table__transform_view_by_mouse_drag_t()
{
LEFT_BUTTON = (long)MouseButtons.Left,
RIGHT_BUTTON = (long)MouseButtons.Right
});
}
private void RenderingCanvas_MouseDown(object sender, MouseEventArgs e)
{
// Handle mouse button press
DispEngine.MouseButtonDown((long)e.Button);
this.Focus();
}
private void RenderingCanvas_MouseUp(object sender, MouseEventArgs e)
{
// Handle mouse button release
DispEngine.MouseButtonUp((long)e.Button);
}
private void RenderingCanvas_MouseWheel(object sender, MouseEventArgs e)
{
// Handle mouse wheel for zoom operations
DispEngine.MouseWheel(0, e.Delta / 120);
DispEngine.MouseWheelTransform(0, e.Delta / 120);
}
</code></pre><h4 id="keyboard-events">Keyboard Events</h4>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;inheritdoc/&gt;
protected override bool IsInputKey(Keys keyData)
{
//since in default, arrow does not trigger key event(keyDown and keyUp).
return true;
}
private void RenderingCanvas_KeyDown(object sender, KeyEventArgs e)
{
Focus();
DispEngine.KeyDown((long)e.KeyData);
// Map specific keys for view transformation
long key = (long)e.KeyData;
if (key == (long)Keys.LShiftKey || key == (long)Keys.RShiftKey || key == (long)Keys.ShiftKey)
key = (long)Keys.Shift;
DispEngine.KeyDownTransform(key, new key_table__transform_view_by_key_pressing_t()
{
HOME = (long)Keys.Home,
PAGE_UP = (long)Keys.PageUp,
PAGE_DOWN = (long)Keys.PageDown,
F1 = (long)Keys.F1,
F2 = (long)Keys.F2,
F3 = (long)Keys.F3,
F4 = (long)Keys.F4,
SHIFT = (long)Keys.Shift,
ARROW_LEFT = (long)Keys.Left,
ARROW_RIGHT = (long)Keys.Right,
ARROW_DOWN = (long)Keys.Down,
ARROW_UP = (long)Keys.Up
});
}
private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
{
DispEngine.KeyUp((long)e.KeyData);
}
</code></pre><h3 id="lifecycle-management">Lifecycle Management</h3>
<p>Window event handling ensures proper state management:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">private void RenderingCanvas_Resize(object sender, EventArgs e)
{
// Notify DispEngine of size changes
DispEngine.Resize(this.ClientSize.Width, this.ClientSize.Height);
}
private void RenderingCanvas_VisibleChanged(object sender, EventArgs e)
{
// Update visibility state in DispEngine
DispEngine.IsVisible = this.Visible;
}
</code></pre><h3 id="resource-cleanup">Resource Cleanup</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Clean up any resources being used.
/// &lt;/summary&gt;
/// &lt;param name=&quot;disposing&quot;&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
protected override void Dispose(bool disposing)
{
if (disposing &amp;&amp; (components != null))
{
// Dispose the DispEngine to free resources
DispEngine.Dispose();
components.Dispose();
}
base.Dispose(disposing);
}
</code></pre><h2 id="wpf-implementation-details">WPF Implementation Details</h2>
<p>The WPF implementation uses WPF-specific controls and mechanisms but follows the same core pattern.</p>
<h3 id="core-properties">Core Properties</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// The DispEngine instance that handles rendering and user interactions
/// &lt;/summary&gt;
public DispEngine DispEngine { get; } = new DispEngine();
/// &lt;summary&gt;
/// Internal container for rendering content
/// &lt;/summary&gt;
private UserControl DisplayerPane { get; }
/// &lt;summary&gt;
/// Dictionary to store touch point information
/// &lt;/summary&gt;
private Dictionary&lt;int, Point&gt; TouchingPointsMap { get; } = new Dictionary&lt;int, Point&gt;();
/// &lt;summary&gt;
/// Dictionary to store previous positions of touch points
/// &lt;/summary&gt;
private Dictionary&lt;int, Point&gt; PreviousTouchingPointsMap { get; } = new Dictionary&lt;int, Point&gt;();
</code></pre><h3 id="initialization-1">Initialization</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Initializes a new instance of the RenderingCanvas
/// &lt;/summary&gt;
public RenderingCanvas()
{
DispEngine.BackgroundColor = new Vec3d(0.1, 0.1, 0.5);
DispEngine.BackgroundOpacity = 0.1;
// Configure the main control properties
HorizontalAlignment = HorizontalAlignment.Stretch;
VerticalAlignment = VerticalAlignment.Stretch;
Focusable = true;
KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Cycle);
DataContextChanged += CanvasDataContextChanged;
// Create and configure the display pane
DisplayerPane = new UserControl();
DisplayerPane.HorizontalAlignment = HorizontalAlignment.Stretch;
DisplayerPane.VerticalAlignment = VerticalAlignment.Stretch;
DisplayerPane.Focusable = true;
DisplayerPane.IsTabStop = true;
// Connect event handlers for user input and window events
DisplayerPane.SizeChanged += RenderingCanvas_SizeChanged;
DisplayerPane.MouseMove += RenderingCanvas_MouseMove;
DisplayerPane.MouseDown += RenderingCanvas_MouseDown;
DisplayerPane.MouseUp += RenderingCanvas_MouseUp;
DisplayerPane.MouseWheel += RenderingCanvas_MouseWheel;
DisplayerPane.KeyDown += RenderingCanvas_KeyDown;
DisplayerPane.KeyUp += RenderingCanvas_KeyUp;
DisplayerPane.Loaded += RenderingCanvas_Loaded;
DisplayerPane.Unloaded += RenderingCanvas_Unloaded;
DisplayerPane.IsVisibleChanged += DisplayerPane_IsVisibleChanged;
// Add touch event handlers
DisplayerPane.TouchDown += RenderingCanvas_TouchDown;
DisplayerPane.TouchMove += RenderingCanvas_TouchMove;
DisplayerPane.TouchUp += RenderingCanvas_TouchUp;
// Enable touch support
this.IsManipulationEnabled = true;
// Add the display pane to this control's content
Content = DisplayerPane;
}
</code></pre><h3 id="rendering-pipeline-1">Rendering Pipeline</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Handles the buffer swapped event from DispEngine
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_BufferSwapped(byte* data, int w, int h)
{
if (data == null)
return;
// Copy pixel data from DispEngine
int n = w * h * 4;
byte[] arr = new byte[n];
for (int i = 0; i &lt; n; i++)
arr[i] = data[i];
// Update UI on the UI thread
DisplayerPane.Dispatcher.InvokeAsync(() =&gt;
{
BitmapSource bitmap = BitmapSource.Create(w, h, 1, 1, PixelFormats.Bgra32, null, arr, w * 4);
DisplayerPane.Background = new ImageBrush(bitmap);
});
}
/// &lt;summary&gt;
/// Handles the size changed event
/// &lt;/summary&gt;
private void RenderingCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Notify DispEngine of size changes
DispEngine.Resize((int)DisplayerPane.RenderSize.Width, (int)DisplayerPane.RenderSize.Height);
}
/// &lt;summary&gt;
/// Handles visibility changes
/// &lt;/summary&gt;
private unsafe void DisplayerPane_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
// Update visibility state in DispEngine
DispEngine.IsVisible = IsVisible;
}
</code></pre><h3 id="mouse-and-keyboard-handling">Mouse and Keyboard Handling</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Helper method to get mouse button mask
/// &lt;/summary&gt;
internal static HiMouseButtonMask GetMouseButtonMask(MouseDevice device)
{
HiMouseButtonMask mouseButtonMask = 0;
mouseButtonMask.SetLeftPressed(device.LeftButton == MouseButtonState.Pressed);
mouseButtonMask.SetMiddlePressed(device.MiddleButton == MouseButtonState.Pressed);
mouseButtonMask.SetRightPressed(device.RightButton == MouseButtonState.Pressed);
mouseButtonMask.SetXButton1Pressed(device.XButton1 == MouseButtonState.Pressed);
mouseButtonMask.SetXButton2Pressed(device.XButton2 == MouseButtonState.Pressed);
return mouseButtonMask;
}
/// &lt;summary&gt;
/// Handles the mouse wheel event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseWheel(object sender, MouseWheelEventArgs e)
{
// Handle mouse wheel for zoom operations
DispEngine.MouseWheel(0, e.Delta / 120);
DispEngine.MouseWheelTransform(0, e.Delta / 120);
}
/// &lt;summary&gt;
/// Handles the mouse up event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseUp(object sender, MouseButtonEventArgs e)
{
// Handle mouse button release
DispEngine.MouseButtonUp((long)e.ChangedButton);
(sender as UIElement)?.ReleaseMouseCapture();
}
/// &lt;summary&gt;
/// Handles the mouse down event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseDown(object sender, MouseButtonEventArgs e)
{
// Handle mouse button press
DispEngine.MouseButtonDown((long)e.ChangedButton);
DisplayerPane.Focus();
(sender as UIElement)?.CaptureMouse();
}
/// &lt;summary&gt;
/// Handles the mouse move event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseMove(object sender, MouseEventArgs e)
{
// Update mouse position and handle drag transforms
Point p = e.GetPosition(DisplayerPane);
DispEngine.MouseMove((int)p.X, (int)p.Y);
DispEngine.MouseDragTransform((int)p.X, (int)p.Y,
new mouse_button_table__transform_view_by_mouse_drag_t()
{
LEFT_BUTTON = (long)MouseButton.Left,
RIGHT_BUTTON = (long)MouseButton.Right
});
}
</code></pre><pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Handles the key up event
/// &lt;/summary&gt;
private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
{
DispEngine.KeyUp((long)e.Key);
}
/// &lt;summary&gt;
/// Handles the key down event
/// &lt;/summary&gt;
private void RenderingCanvas_KeyDown(object sender, KeyEventArgs e)
{
DispEngine.KeyDown((long)e.Key);
// Map specific keys for view transformation
long key = (long)e.Key;
if (key == (long)Key.RightShift)
key = (long)Key.LeftShift;
DispEngine.KeyDownTransform(key, new key_table__transform_view_by_key_pressing_t()
{
HOME = (long)Key.Home,
PAGE_UP = (long)Key.PageUp,
PAGE_DOWN = (long)Key.PageDown,
F1 = (long)Key.F1,
F2 = (long)Key.F2,
F3 = (long)Key.F3,
F4 = (long)Key.F4,
SHIFT = (long)Key.LeftShift,
ARROW_LEFT = (long)Key.Left,
ARROW_RIGHT = (long)Key.Right,
ARROW_DOWN = (long)Key.Down,
ARROW_UP = (long)Key.Up
});
}
</code></pre><h3 id="lifecycle-management-1">Lifecycle Management</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Handles window state changes (maximize, minimize, etc.)
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_StateChanged(object sender, EventArgs e)
{
switch ((sender as Window).WindowState)
{
case WindowState.Maximized:
DispEngine.IsVisible = true;
break;
case WindowState.Minimized:
DispEngine.IsVisible = false;
break;
case WindowState.Normal:
DispEngine.IsVisible = true;
break;
}
}
/// &lt;summary&gt;
/// Handles data context changes
/// &lt;/summary&gt;
private unsafe void CanvasDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
DispEngine pre = e.OldValue as DispEngine;
DispEngine cur = e.NewValue as DispEngine;
//child's binding event is triggered after IsVisible event and Load event.
if (pre != null) //this section will never occur if the datacontext not set twice.
{
pre.Terminate();
pre.ImageRequestAfterBufferSwapped -= RenderingCanvas_BufferSwapped;
}
if (cur != null)
{
cur.ImageRequestAfterBufferSwapped += RenderingCanvas_BufferSwapped;
cur.Start((int)DisplayerPane.RenderSize.Width, (int)DisplayerPane.RenderSize.Height);
cur.IsVisible = IsVisible;
}
}
/// &lt;summary&gt;
/// Reference to the current window containing this control
/// &lt;/summary&gt;
private Window currentWindow;
/// &lt;summary&gt;
/// Gets or sets the current window, connecting or disconnecting state change events
/// &lt;/summary&gt;
Window CurrentWindow
{
get =&gt; currentWindow; set
{
if (currentWindow != null)
currentWindow.StateChanged -= RenderingCanvas_StateChanged;
currentWindow = value;
if (currentWindow != null)
currentWindow.StateChanged += RenderingCanvas_StateChanged;
}
}
/// &lt;summary&gt;
/// Handles the loaded event
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_Loaded(object sender, RoutedEventArgs e)
{
// Get the window containing this control
CurrentWindow = Window.GetWindow(this);
// Set up DispEngine rendering
DispEngine.ImageRequestAfterBufferSwapped -= RenderingCanvas_BufferSwapped;
DispEngine.ImageRequestAfterBufferSwapped += RenderingCanvas_BufferSwapped;
DispEngine.Start((int)DisplayerPane.RenderSize.Width, (int)DisplayerPane.RenderSize.Height);
DispEngine.IsVisible = IsVisible;
}
/// &lt;summary&gt;
/// Handles the unloaded event
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_Unloaded(object sender, RoutedEventArgs e)
{
DispEngine.IsVisible = IsVisible;
DispEngine.ImageRequestAfterBufferSwapped -= RenderingCanvas_BufferSwapped;
CurrentWindow = null;
}
</code></pre><h3 id="resource-cleanup-1">Resource Cleanup</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Flag to track disposed state
/// &lt;/summary&gt;
private bool disposedValue;
/// &lt;summary&gt;
/// Disposes managed resources
/// &lt;/summary&gt;
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// Dispose the DispEngine to free resources
DispEngine.Dispose();
}
disposedValue = true;
}
}
/// &lt;summary&gt;
/// Public dispose method to free resources
/// &lt;/summary&gt;
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
</code></pre><h2 id="core-dispengine-integration-patterns">Core DispEngine Integration Patterns</h2>
<h3 id="1-initialization-sequence">1. Initialization Sequence</h3>
<pre><code class="lang-csharp">// Create DispEngine (optionally with displayees)
var engine = new DispEngine(displayees);
// Set up image buffer callback
engine.ImageRequestAfterBufferSwapped += OnBufferSwapped;
// Initialize with canvas size
engine.Start(width, height);
// Set initial view (optional)
engine.SetViewToHomeView();
</code></pre>
<h3 id="2-render-loop">2. Render Loop</h3>
<p>The rendering process follows this pattern:</p>
<ol>
<li><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> processes <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> objects</li>
<li>Buffer is swapped and callback is triggered</li>
<li>UI framework renders the buffer to screen</li>
<li>User input triggers view updates</li>
<li>Process repeats</li>
</ol>
<h3 id="3-complete-user-input-mapping">3. Complete User Input Mapping</h3>
<p>All user interactions must be mapped to <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> methods:</p>
<table>
<thead>
<tr>
<th>User Action</th>
<th>DispEngine Method</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mouse move</td>
<td><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseMove_System_Int32_System_Int32_">MouseMove(int, int)</a></td>
</tr>
<tr>
<td>Mouse drag</td>
<td><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseDragTransform_System_Int32_System_Int32_Hi_Native_mouse_button_table__transform_view_by_mouse_drag_t_">MouseDragTransform(int, int, mouse_button_table__transform_view_by_mouse_drag_t)</a></td>
</tr>
<tr>
<td>Mouse button</td>
<td><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseButtonDown_System_Int64_">MouseButtonDown(long)</a> / <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseButtonUp_System_Int64_">MouseButtonUp(long)</a></td>
</tr>
<tr>
<td>Mouse wheel</td>
<td><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseWheel_System_Int32_System_Int32_">MouseWheel(int, int)</a> and <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseWheelTransform_System_Int32_System_Int32_System_Double_">MouseWheelTransform(int, int, double)</a></td>
</tr>
<tr>
<td>Key press</td>
<td><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyDown_System_Int64_">KeyDown(long)</a> / <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyUp_System_Int64_">KeyUp(long)</a> and <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyDownTransform_System_Int64_Hi_Native_key_table__transform_view_by_key_pressing_t_">KeyDownTransform(long, key_table__transform_view_by_key_pressing_t)</a></td>
</tr>
<tr>
<td>Touch events</td>
<td><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TouchDown_System_Int32_System_Int32_System_Int32_">TouchDown(int, int, int)</a> / <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TouchMove_System_Int32_System_Int32_System_Int32_">TouchMove(int, int, int)</a> / <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TouchUp_System_Int32_">TouchUp(int)</a></td>
</tr>
</tbody>
</table>
<h3 id="4-proper-resource-cleanup">4. Proper Resource Cleanup</h3>
<p>Resource management is critical for proper operation:</p>
<pre><code class="lang-csharp">// In dispose method
DispEngine.ImageRequestAfterBufferSwapped -= OnBufferSwapped;
DispEngine.Terminate();
DispEngine.Dispose();
</code></pre>
<h2 id="advanced-implementation-considerations">Advanced Implementation Considerations</h2>
<p>When creating custom implementations, consider these aspects:</p>
<h3 id="view-manipulation">View Manipulation</h3>
<p>Use <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SketchView">SketchView</a> to directly access or modify the view matrix:</p>
<pre><code class="lang-csharp">// Get current view matrix
Mat4d currentView = engine.SketchView;
// Apply custom rotation
Mat4d rotation = Mat4d.RotateX(Math.PI/4);
engine.SketchView = currentView * rotation;
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../../../api/Hi.Geom.Vec2d.html">Vec2d</a></li>
<li><a class="xref" href="../../../../../api/Hi.Geom.Mat4d.html">Mat4d</a></li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,305 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Using RenderingCanvas with DispEngine | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Using RenderingCanvas with DispEngine | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../../../public/main.css">
<meta name="docfx:navrel" content="../../../../../toc.html">
<meta name="docfx:tocrel" content="../../../toc.html">
<meta name="docfx:rel" content="../../../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../../../index.html">
<img id="logo" class="svg" src="../../../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="using-renderingcanvas-with-dispengine">Using RenderingCanvas with DispEngine</h1>
<p>The <code>RenderingCanvas</code> is the primary UI component for displaying and interacting with 3D content across different platforms. This section explains how to use it with the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> to create cross-platform applications.</p>
<h2 id="overview">Overview</h2>
<p>The <code>RenderingCanvas</code> class is available in frameworks:</p>
<ul>
<li><code>Hi.WinForm</code> for Windows Forms applications</li>
<li><code>Hi.Wpf</code> for WPF applications</li>
</ul>
<p>All implementations share a common architecture centered around the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> class, enabling consistent rendering and interaction across platforms.</p>
<h2 id="core-concept-dispengine-and-idisplayee">Core Concept: DispEngine and IDisplayee</h2>
<p>At the heart of the rendering system is the relationship between <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> and <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a>:</p>
<ul>
<li><strong>DispEngine</strong>: The rendering engine that manages the OpenGL context and handles user interaction</li>
<li><strong>IDisplayee</strong>: The interface that defines objects that can be rendered by the DispEngine</li>
</ul>
<p>This relationship is fundamental - <strong>the primary purpose of DispEngine is to render IDisplayee objects</strong>.</p>
<pre><code class="lang-mermaid">graph TD
A[RenderingCanvas UI Component] --&gt; B[DispEngine]
B --&gt; C[Rendering Pipeline]
B --&gt; D[Input Handling]
B --&gt; E[View Manipulation]
F[IDisplayee Objects] --&gt;|Rendered by| B
</code></pre>
<h3 id="working-with-idisplayee">Working with IDisplayee</h3>
<p>Objects implementing <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> define what gets rendered. Typically, you'll use <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a> objects or compose multiple IDisplayee objects together:</p>
<pre><code class="lang-csharp">// Create a composite displayee
public class MyCompositeDisplayee : IDisplayee
{
private List&lt;IDisplayee&gt; _displayees = new List&lt;IDisplayee&gt;();
public MyCompositeDisplayee()
{
// Add various displayees
_displayees.Add(new AxesDisplayee());
_displayees.Add(new ModelDisplayee());
}
public void Display(Bind bind)
{
// Render all contained displayees
foreach (var displayee in _displayees)
{
displayee.Display(bind);
}
}
public void ExpandToBox3d(Box3d box)
{
// Update bounding box based on all displayees
foreach (var displayee in _displayees)
{
displayee.ExpandToBox3d(box);
}
}
}
</code></pre>
<p>Multiple displayees can be combined using <a class="xref" href="../../../../../api/Hi.Disp.DispList.html">DispList</a>:</p>
<pre><code class="lang-csharp">// Combine multiple displayees
var displayList = new DispList();
displayList.Add(myModel);
displayList.Add(myAnnotations);
displayList.Add(myCoordinateSystem);
// Pass to DispEngine
engine.Displayee = displayList;
</code></pre>
<p>For more detailed information on creating displayees with <a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a>, see the <a href="../drawing/index.html">Drawing</a> section.</p>
<h2 id="basic-usage">Basic Usage</h2>
<h3 id="winform-implementation">WinForm Implementation</h3>
<pre><code class="lang-csharp">// Create a new instance with displayee objects
using Hi.WinForm.Disp;
// Create displayee object
var displayee = new MyCompositeDisplayee();
// Initialize canvas with the displayee
var canvas = new RenderingCanvas(displayee);
// Access the DispEngine for direct manipulation
DispEngine engine = canvas.DispEngine;
// Add to a form
myForm.Controls.Add(canvas);
</code></pre>
<h3 id="wpf-implementation">WPF Implementation</h3>
<pre><code class="lang-csharp">// Create a new instance
using Hi.Wpf.Disp;
// Create displayee object
var displayee = new MyCompositeDisplayee();
// Initialize the canvas
var canvas = new RenderingCanvas();
// Set displayee objects through the DispEngine
canvas.DispEngine.Displayee = displayee;
// Add to a container
myGrid.Children.Add(canvas);
</code></pre>
<h2 id="switching-displayees-at-runtime">Switching Displayees at Runtime</h2>
<p>You can dynamically change what's being displayed:</p>
<pre><code class="lang-csharp">// Switch to a different displayee
renderingCanvas.DispEngine.Displayee = alternativeDisplayee;
// Or update a DispList
var displayList = new DispList();
if (showModel) displayList.Add(modelDisplayee);
if (showGrid) displayList.Add(gridDisplayee);
renderingCanvas.DispEngine.Displayee = displayList;
</code></pre>
<h2 id="key-features-of-dispengine">Key Features of DispEngine</h2>
<p>The <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> provides cross-platform support for:</p>
<ol>
<li><p><strong>Rendering Pipeline Management</strong></p>
<ul>
<li>Handles buffer swapping and image generation</li>
<li>Manages GPU resources efficiently</li>
</ul>
</li>
<li><p><strong>Input Handling</strong></p>
<ul>
<li>Mouse/pointer events (move, click, drag)</li>
<li>Keyboard navigation</li>
<li>Touch gestures (pinch, rotate, pan)</li>
</ul>
</li>
<li><p><strong>View Manipulation</strong></p>
<ul>
<li>Camera positioning and orientation</li>
<li>Standard views (front, top, isometric, etc.)</li>
<li>Zoom, pan, and rotate operations</li>
</ul>
</li>
<li><p><strong>DisplayeeObjects Management</strong></p>
<ul>
<li>Renders <a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> implementations</li>
<li>Manages visibility and drawing state</li>
</ul>
</li>
</ol>
<h2 id="touch-and-gesture-support">Touch and Gesture Support</h2>
<p>The <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a> centralizes touch handling across all platforms with a unified API that supports:</p>
<ul>
<li>Single-finger pan</li>
<li>Two-finger rotate and scale</li>
<li>Multi-finger specialized operations</li>
</ul>
<p>The touch API is designed to be simple for UI implementations to use. Platform-specific UI components only need to capture touch events and forward them to the DispEngine.</p>
<h3 id="basic-touch-api-example">Basic Touch API Example</h3>
<pre><code class="lang-csharp">// When a touch point is detected
DispEngine.TouchDown(touchId, x, y);
// When a touch point moves
DispEngine.TouchMove(touchId, x, y);
// When a touch point is released
DispEngine.TouchUp(touchId);
</code></pre>
<h2 id="common-operations">Common Operations</h2>
<pre><code class="lang-csharp">// Accessing DispEngine (works on all platforms)
var engine = renderingCanvas.DispEngine;
// Set to standard views
engine.SetViewToHomeView();
engine.SetViewToFrontView();
// Manual camera manipulation
engine.Translate(dx, dy);
engine.Rotate(deltaX, deltaY);
// Resize handling
engine.Resize(width, height);
</code></pre>
<h2 id="implementation-details">Implementation Details</h2>
<p>For detailed implementation information, including:</p>
<ul>
<li>Full source code examples</li>
<li>Implementation details for each platform</li>
<li>Advanced touch handling</li>
<li>Custom implementation guidance</li>
</ul>
<p>See the <a href="custom-implementation.html">Building Your Own RenderingCanvas</a> guide.</p>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../../../api/Hi.Disp.DispList.html">DispList</a></li>
<li><a class="xref" href="../../../../../api/Hi.Disp.Drawing.html">Drawing</a></li>
<li><a href="custom-implementation.html">Building Your Own RenderingCanvas</a></li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,201 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Getting Started with HiAPI | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Getting Started with HiAPI | HiAPI-C# 2025 ">
<link rel="icon" href="../../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../../public/docfx.min.css">
<link rel="stylesheet" href="../../../public/main.css">
<meta name="docfx:navrel" content="../../../toc.html">
<meta name="docfx:tocrel" content="../toc.html">
<meta name="docfx:rel" content="../../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../../index.html">
<img id="logo" class="svg" src="../../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="getting-started-with-hiapi">Getting Started with HiAPI</h1>
<p>This guide will help you get started with HiAPI development.</p>
<h2 id="installation">Installation</h2>
<ol>
<li><p>Create a dotnet project.</p>
</li>
<li><p>Setting the nuget server and account.</p>
<p>The HiAPI installation is typical Nuget Package installation. You can apply global or local nuget setting.</p>
<p>Here apply the local solution for startup. Create a file and name it to <code>nuget.config</code> in the same folder of your dotnet project file. the content of the file is as the following:</p>
<pre><code class="lang-xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;configuration&gt;
&lt;packageSources&gt;
&lt;add key=&quot;HiAPI&quot; value=&quot;https://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json&quot; /&gt;
&lt;add key=&quot;nuget.org&quot; value=&quot;https://api.nuget.org/v3/index.json&quot; protocolVersion=&quot;3&quot; /&gt;
&lt;/packageSources&gt;
&lt;packageSourceCredentials&gt;
&lt;HiAPI&gt;
&lt;add key=&quot;Username&quot; value=&quot;xxxxxx&quot; /&gt;
&lt;add key=&quot;ClearTextPassword&quot; value=&quot;xxxxxx&quot; /&gt;
&lt;/HiAPI&gt;
&lt;/packageSourceCredentials&gt;
&lt;/configuration&gt;
</code></pre>
</li>
<li><p>In the dotnet project file, add the package reference.</p>
<pre><code class="lang-xml">&lt;ItemGroup&gt;
&lt;PackageReference Include=&quot;HiNc&quot; Version=&quot;1.4.*&quot; /&gt;
&lt;!--optional--&gt;
&lt;PackageReference Include=&quot;Hi.Wpf&quot; Version=&quot;*&quot; /&gt;
&lt;/ItemGroup&gt;
</code></pre>
</li>
<li><p>In the program file, setting the environment initialization and finalization.</p>
<pre><code class="lang-csharp" name="SampleCode">using Hi.Disp;
using Hi.Licenses;
using Hi.MongoUtils;
using System;
namespace Sample
{
/// &lt;summary&gt;
/// A sample class demonstrating initialization and usage of the HiAPI framework.
/// Shows the basic setup of display engine, MongoDB server, licensing, and other core functionality.
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// This example serves as an entry point for those getting started with HiAPI.
/// It demonstrates proper initialization and teardown of key components.
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample/HelloHiAPI.cs)]
/// &lt;/remarks&gt;
public static class HelloHiAPI
{
static int Main(string[] args)
{
Console.WriteLine(&quot;HiAPI starting.&quot;);
License.LogInAll();
DispEngine.Init();
MongoServer.Default = MongoServer.Run(new MongoRunnerOptions()
{
MongoPort = 28100
});
Console.WriteLine(&quot;Hello World! HiAPI.&quot;);
MongoServer.Default.Dispose();
DispEngine.FinishDisp();
License.LogOutAll();
Console.WriteLine(&quot;HiAPI exited.&quot;);
return 0;
}
}
}
</code></pre>
<p>If 3D rendering is not required, the setting of <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> can be eliminated.</p>
</li>
</ol>
<h2 id="sample-code-to-start-a-">Sample Code to Start a <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a></h2>
<p>See the following sample code to start a HiAPI application.</p>
<ul>
<li><a class="xref" href="../../sample/Sample.Machining.DemoBuildMachiningProject.html">DemoBuildMachiningProject</a>
Build a <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>.</li>
<li><a class="xref" href="../../sample/Sample.Machining.DemoUseMachiningProject.html">DemoUseMachiningProject</a>
Load a <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> and run NC simulation.</li>
<li><a class="xref" href="../../sample/Sample.Machining.DemoRenderingMachiningProcessAndStripPosSelection.html">DemoRenderingMachiningProcessAndStripPosSelection</a>
Apply <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> to 3D canvas with user-interaction in windows platform.</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,157 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HiAPI Overview | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="HiAPI Overview | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="hiapi-overview">HiAPI Overview</h1>
<p>HiAPI is a C# software development kit for machining simulation. It provides libraries for NC motion simulation, collision detection, geometry removal simulation, milling force simulation, optimization, and more.</p>
<h2 id="nuget-packages">Nuget Packages</h2>
<p>The HiAPI is applied by the form of Nuget Packages. You have to apply <code>HiNc</code> nuget package and its dependencies. They include all the functionality of the HiNC software, but do not include the GUI components.</p>
<p>The packages can be downloaded and installed from the HiAPI NuGet Server. The server URL is:</p>
<p><a href="%5Bhttps://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json">https://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json</a></p>
<div class="NOTE">
<h5>Note</h5>
<ul>
<li>Authentication is required to access the server (username and password)</li>
<li>Direct browser access to the URL will not show meaningful content. Since the server is designed for Visual Studio NuGet package management. For more information about NuGet, visit <a href="https://www.nuget.org/">NuGet.org</a></li>
</ul>
</div>
<h3 id="package-dependencies">Package Dependencies</h3>
<p>The <code>HiNc</code> package has the following dependency chain:</p>
<pre><code class="lang-mermaid">graph LR
HiGeom --&gt; HiDisp
HiDisp --&gt; HiCbtr
HiCbtr --&gt; HiMech
HiMech --&gt; HiUniNc
HiUniNc --&gt; HiNc
HiDisp --&gt; Hi.WinForm
HiDisp --&gt; Hi.Wpf
style HiNc fill:#d3d,stroke:#333,stroke-width:2px
</code></pre>
<h3 id="ui-framework-support">UI Framework Support</h3>
<p>If you need to develop Windows desktop applications:</p>
<ul>
<li>For Windows Forms applications, use the <code>Hi.WinForm</code> package</li>
<li>For WPF applications, use the <code>Hi.Wpf</code> package</li>
</ul>
<div class="NOTE">
<h5>Note</h5>
<p>See <a href="basic/rendering/rendering-canvas/custom-implementation.html">Building Your Own Rendering Canvas</a> to build the rendering canvas cross-platform.</p>
</div>
<h2 id="hiapi-sample-code">HiAPI Sample Code</h2>
<p>See <a href="../sample/Sample.Machining.html">Sample Code</a> or download the repositories to get more samples. The following sample repository demonstrate various aspects of using HiAPI for machining simulation:</p>
<ul>
<li>The <a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.Sample">Hi.Sample Repository</a> contains a collection of sample projects showcasing different features and capabilities of HiAPI with no platform constrain.</li>
<li>The <a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.Sample.Wpf">Hi.Sample.Wpf Repository</a> repository contains samples specifically designed for Windows Presentation Foundation applications.</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,137 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>System Requirements | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="System Requirements | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="system-requirements">System Requirements</h1>
<ul>
<li><strong>Operating System</strong>:
<ul>
<li>Windows 10 or later</li>
<li>Ubuntu 22.04 LTS</li>
</ul>
</li>
<li><strong>CPU Architecture</strong>: x64 (ARM not yet supported)</li>
<li><strong>Runtime</strong>: .NET 9.0 or later</li>
<li><strong>Memory (RAM)</strong>:
<ul>
<li>Minimum: 8GB RAM (suitable for low-resolution models)</li>
<li>Recommended: 128GB RAM or higher (for large and detailed models)</li>
</ul>
</li>
<li><strong>Graphics</strong>:
<ul>
<li>OpenGL 4.4 compatible graphics card or integrated graphics</li>
<li>Most computers manufactured within the last 15 years meet this requirement</li>
</ul>
</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,67 @@
<div id="sidetoggle">
<div>
<div class="sidefilter">
<form class="toc-filter">
<span class="glyphicon glyphicon-filter filter-icon"></span>
<span class="glyphicon glyphicon-remove clear-icon" id="toc_filter_clear"></span>
<input type="text" id="toc_filter_input" placeholder="Filter by title" onkeypress="if(event.keyCode==13) {return false;}">
</form>
</div>
<div class="sidetoc">
<div class="toc" id="toc">
<ul class="nav level1">
<li>
<a href="index.html" name="" title="Overview">Overview</a>
</li>
<li>
<a href="system-requirements.html" name="" title="System Requirements">System Requirements</a>
</li>
<li>
<a href="getting-started/index.html" name="" title="Getting Started">Getting Started</a>
</li>
<li>
<span class="expand-stub"></span>
<a>Logic Basic</a>
<ul class="nav level2">
<li>
<span class="expand-stub"></span>
<a href="basic/rendering/index.html" name="" title="Rendering">Rendering</a>
<ul class="nav level3">
<li>
<a href="basic/rendering/rendering-canvas/index.html" name="" title="Using RenderingCanvas with DispEngine">Using RenderingCanvas with DispEngine</a>
</li>
<li>
<a href="basic/rendering/rendering-canvas/custom-implementation.html" name="" title="Building Your Own Rendering Canvas">Building Your Own Rendering Canvas</a>
</li>
<li>
<a href="basic/rendering/drawing/index.html" name="" title="Drawing">Drawing</a>
</li>
</ul>
</li>
<li>
<span class="expand-stub"></span>
<a>Mechanism Topology</a>
<ul class="nav level3">
<li>
<a href="basic/mechanism/index.html" name="" title="Overview">Overview</a>
</li>
<li>
<a href="basic/mechanism/Topo/index.html" name="" title="Topology Structure">Topology Structure</a>
</li>
<li>
<a href="basic/mechanism/transformers/index.html" name="" title="Transformers">Transformers</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
@@ -0,0 +1,2 @@
{"items":[{"name":"Overview","href":"index.html","topicHref":"index.html"},{"name":"System Requirements","href":"system-requirements.html","topicHref":"system-requirements.html"},{"name":"Getting Started","href":"getting-started/index.html","topicHref":"getting-started/index.html"},{"name":"Logic Basic","items":[{"name":"Rendering","href":"basic/rendering/index.html","topicHref":"basic/rendering/index.html","items":[{"name":"Using RenderingCanvas with DispEngine","href":"basic/rendering/rendering-canvas/index.html","topicHref":"basic/rendering/rendering-canvas/index.html"},{"name":"Building Your Own Rendering Canvas","href":"basic/rendering/rendering-canvas/custom-implementation.html","topicHref":"basic/rendering/rendering-canvas/custom-implementation.html"},{"name":"Drawing","href":"basic/rendering/drawing/index.html","topicHref":"basic/rendering/drawing/index.html"}]},{"name":"Mechanism Topology","items":[{"name":"Overview","href":"basic/mechanism/index.html","topicHref":"basic/mechanism/index.html"},{"name":"Topology Structure","href":"basic/mechanism/Topo/index.html","topicHref":"basic/mechanism/Topo/index.html"},{"name":"Transformers","href":"basic/mechanism/transformers/index.html","topicHref":"basic/mechanism/transformers/index.html"}]}]}]}