[컴선설] Lec 09 Surface Reconstruction from Offset Table
LN09. Surface Reconstruction from Offset Table
1. Surface Reconstruction from Offset Table
- An offset table stores points on the hull surface at each station.
- The goal is to regenerate a curved hull surface from the point data and visualize it.
Procedure
- Read the offset-table data file.
- Generate a winged-edge structure or an equivalent topology structure.
- Reconstruct the surface from the offset-table points.
- Visualize the reconstructed surface.

2. Offset Table
Principal Characteristics of the Ship and Coordinates
- LOA: Length Overall, the maximum length of the hull.
- LBP: Length Between Perpendiculars, from A.P. to F.P.
- A.P.: After Perpendicular, generally the center line of the rudder.
- F.P.: Fore Perpendicular, the perpendicular at the bow on the designed water line.
- W.L.: Water Line.
- B.L.: Base Line.
- The intersection of A.P. and B.L. is used as the origin.
- Use the left-hand coordinate system.

Offset-Table Data
- The offset table stores point-on-surface information.
- The $X$ and $Z$ coordinates are given in meters.
- The corresponding $Y$ coordinate is stored in millimeters.
Example
\[\mathbf{p} = \begin{bmatrix} 8.25\\ 0.2435\\ 4 \end{bmatrix}\]
Point Validation
- A zero value does not always mean that the point is invalid.
- Examine the upper, lower, left, right, and diagonal neighboring entries.
- If at least one neighboring entry is nonzero, the point is valid.
- If every neighboring entry is zero, the point is invalid.

The valid points read from the table can be visualized directly before surface reconstruction.

3. Topology Structure
A simple array of points is inconvenient for searching adjacent points, edges, and faces. Store the geometric entities together with their adjacency information.

Winged-Edge Structure
For one reference edge, store
- the start and end vertices,
- the left and right faces,
- the previous and next edges on the left face,
- the previous and next edges on the right face.
struct WingedEdge {
Edge* self;
Point* start;
Point* end;
WingedEdge* rightprev;
WingedEdge* rightnext;
WingedEdge* leftprev;
WingedEdge* leftnext;
Surface* right;
Surface* left;
};

Search all edges of a face in cyclic order.
void SearchAdjacentEdgesOfSurface(WingedEdge* initial, Surface* S)
{
WingedEdge* current = initial;
do {
Visit(current);
if (current->right == S)
current = current->rightnext;
else
current = current->leftnext;
} while (current != initial);
}

4. Surface Reconstruction
Each topology face is reconstructed as one surface patch. Adjacent patches share boundary entities, so they satisfy $C^0$ continuity automatically.
Procedure
- Compute a normal vector at every data point.
- Compute the control points of each boundary curve.
- Construct a Coons patch from the boundary curves.

Compute the Normal Vector for Each Data Point
Create triangles from a vertex and its adjacent vertices. Compute the normal of each adjacent triangle and average the normals.
\[\mathbf{n}_{f} = \frac{(\mathbf{p}_{1}-\mathbf{p}_{0})\times(\mathbf{p}_{2}-\mathbf{p}_{0})} {\left\|(\mathbf{p}_{1}-\mathbf{p}_{0})\times(\mathbf{p}_{2}-\mathbf{p}_{0})\right\|}\] \[\mathbf{n}_{v} = \frac{\displaystyle\sum_{f\in F(v)}\mathbf{n}_{f}} {\left\|\displaystyle\sum_{f\in F(v)}\mathbf{n}_{f}\right\|}\]Compute the Control Points for Each Edge
- Use the endpoint positions and endpoint normals to construct the boundary curve.
- The boundary curve is shared by the two adjacent patches.
- Exact $C^1$ continuity requires additional off-boundary constraints.
- The practical construction satisfies $C^0$ continuity and approaches $G^1$ continuity.

$G^1$ continuity is tangent-plane continuity. $C^1$ continuity additionally requires compatible parameterization across the common boundary.

Point-Normal Interpolation
Bruce Piper method
Project the opposite endpoint onto the tangent plane at $\mathbf{p}_0$.
\[\mathbf{p}_{\mathrm{proj}} = \mathbf{p}_{1} - \frac{(\mathbf{p}_{1}-\mathbf{p}_{0})\cdot\mathbf{n}_{0}} {\mathbf{n}_{0}\cdot\mathbf{n}_{0}} \mathbf{n}_{0}\]Place the first interior control point at one third of the projected direction.
\[\mathbf{b}_{1} = \mathbf{p}_{0} + \frac{1}{3} (\mathbf{p}_{\mathrm{proj}}-\mathbf{p}_{0})\]Compute $\mathbf{b}_2$ in the same way from the other endpoint and its normal.

Coons Patch
Rectangular Coons Patch
Let $\boldsymbol{\alpha}_1(u)$ and $\boldsymbol{\alpha}_2(u)$ be the bottom and top boundaries, and let $\boldsymbol{\beta}_1(v)$ and $\boldsymbol{\beta}_2(v)$ be the left and right boundaries.
\[\begin{aligned} \mathbf{x}(u,v) ={}&(1-v)\boldsymbol{\alpha}_1(u) +v\boldsymbol{\alpha}_2(u) +(1-u)\boldsymbol{\beta}_1(v) +u\boldsymbol{\beta}_2(v)\\ &-\Big[(1-u)\big((1-v)\mathbf{b}_{00}+v\mathbf{b}_{03}\big) +u\big((1-v)\mathbf{b}_{30}+v\mathbf{b}_{33}\big)\Big] \end{aligned}\]Corner compatibility
\[\mathbf{b}_{00}=\boldsymbol{\alpha}_1(0)=\boldsymbol{\beta}_1(0)\] \[\mathbf{b}_{03}=\boldsymbol{\alpha}_2(0)=\boldsymbol{\beta}_1(1)\] \[\mathbf{b}_{30}=\boldsymbol{\alpha}_1(1)=\boldsymbol{\beta}_2(0)\] \[\mathbf{b}_{33}=\boldsymbol{\alpha}_2(1)=\boldsymbol{\beta}_2(1)\]
Triangular Coons Patch - Method 1
For barycentric coordinates
\[u+v+w=1\]construct three ruled surfaces.
\[\mathbf{X}_{A}=u\mathbf{A}+(1-u)\mathbf{C}_{BC}(v,w)\] \[\mathbf{X}_{B}=v\mathbf{B}+(1-v)\mathbf{C}_{CA}(u,w)\] \[\mathbf{X}_{C}=w\mathbf{C}+(1-w)\mathbf{C}_{AB}(u,v)\] \[\mathbf{X}_{T}=u\mathbf{A}+v\mathbf{B}+w\mathbf{C}\] \[\mathbf{X}=\mathbf{X}_{A}+\mathbf{X}_{B}+\mathbf{X}_{C}-2\mathbf{X}_{T}\]
Triangular Coons Patch - Method 2
Combine the three directional patches and subtract the linear triangular patch.
\[\mathbf{S} = \frac{1}{2} \left( \mathbf{S}_{u}+\mathbf{S}_{v}+\mathbf{S}_{w}-\mathbf{S}_{L} \right)\] \[\text{middle point coefficient} = \frac{1+1+1-1}{2}=1\] \[\text{curved-boundary coefficient} = \frac{1+1}{2}=1\] \[\text{linear-boundary coefficient} = \frac{1-1}{2}=0\]
5. Visualization Using OpenGL
Divide the parameter domain into an $N\times N$ grid. Split every grid cell along a diagonal.
\[\text{number of triangles}=2N^2\]Evaluate points on the surface using the de Casteljau algorithm in one parameter direction and then in the other direction.

glBegin(GL_TRIANGLES);
for (const Triangle& tri : mesh) {
glVertex3f(tri.p0.x, tri.p0.y, tri.p0.z);
glVertex3f(tri.p1.x, tri.p1.y, tri.p1.z);
glVertex3f(tri.p2.x, tri.p2.y, tri.p2.z);
}
glEnd();