Skip to content

Commit 3003066

Browse files
AzgaarCopilot
andcommitted
refactor: specify return type for buildCoastlinePath function and optimize variable declaration
Co-authored-by: Copilot <copilot@github.com>
1 parent 975747a commit 3003066

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/renderers/coastline-fractal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export function fractalizeCoastline(
207207
* Smooth span: Q midpoint B-spline — identical to curveBasisClosed. Produces flowing arcs that hide Voronoi angularity.
208208
* Jagged span: centripetal Catmull-Rom (α=0.5) through every fractal sub-point. Rounds sharp kinks into gentle curves.
209209
*/
210-
export function buildCoastlinePath(shape: FractalizedShape) {
210+
export function buildCoastlinePath(shape: FractalizedShape): string {
211211
const { points: pts, origIndices } = shape;
212212
const N = pts.length;
213213
const M = origIndices.length;
@@ -233,12 +233,12 @@ export function buildCoastlinePath(shape: FractalizedShape) {
233233
const ci = origIndices[i];
234234
const ni = origIndices[(i + 1) % M];
235235
const [cpx, cpy] = pts[ci];
236-
const [npx, npy] = pts[ni];
237236

238237
if (smooth[i]) {
239238
// Q midpoint B-spline ≡ curveBasisClosed.
240239
// When arriving from a jagged span the cursor is already at cpx,cpy
241240
// so just line to the midpoint instead of emitting a degenerate Q.
241+
const [npx, npy] = pts[ni];
242242
const mx = (cpx + npx) / 2;
243243
const my = (cpy + npy) / 2;
244244
d.push(atMid ? `Q${cpx},${cpy} ${mx},${my}` : `L${mx},${my}`);

0 commit comments

Comments
 (0)