Fence Feature Placement Logic (fence/fence-features.ts)

editor · packages/core/src/systems/fence/fence-features.ts · typescript · MIT
pos, ui, lang:typescript, tag:geometry, tag:editor, tag:spatial

Calculates and validates the placement of features along a fence centerline. Use this to manage spatial constraints and geometry for architectural or layout editors.

// Source: https://github.com/pascalorg/editor | License: MIT | Copyright 2026 Pascal Group Inc
// Provided via justclaw.it.com; keep this notice with the code.
import type { z } from 'zod'
import type { AnyNode, FenceFeatureNode, FenceNode } from '../../schema'
import type { FenceFeature } from '../../schema/nodes/fence'
import {
  getFenceCenterlineFrameAt,
  getFenceCenterlineLength,
  sampleFenceCenterline,
} from './fence-centerline'

export type FenceFeatureData = z.infer<typeof FenceFeature>
export type FenceWithFeatures = FenceNode & { features?: FenceFeatureData[] }
export type ResolvedFenceFeature = FenceFeatureData & {
  startT: number
  endT: number
  centerT: number
}

export function fenceFeaturePlacementIssue(
  fence: FenceWithFeatures,
  feature: FenceFeatureData,
): 'widt

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key