Appearance
Query: Profile
Profile queries — read-only geometric questions about a profile (an ordered loop or chain of curves) and the relationships between two profiles. Accessed via snaptrude.core.geom.query.profile.
Every method takes an opaque ProfileHandle (plus point handles Vec3Handle where relevant) and returns plain values — points as Vec3Components, areas/perimeters/distances as number, predicates as boolean, the bounding box as BBoxComponents. Methods that enumerate the profile's child curves return fresh CurveHandle[]. No query mutates its inputs.
Passing an invalid, stale, or foreign handle rejects the call with HandleInvalidError (code HANDLE_INVALID).
Types
Vec3Components
Plain read-out of a 3D point or vector.
| Property | Type | Description |
|---|---|---|
x | number | X component |
y | number | Y component |
z | number | Z component |
BBoxComponents
Axis-aligned bounding box as plain components.
| Property | Type | Description |
|---|---|---|
min | Vec3Components | Minimum corner of the box |
max | Vec3Components | Maximum corner of the box |
Functions
listPoints(profile)
List the tessellated points along a profile.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
Vec3Components[]— The profile points
ts
const points = await snaptrude.core.geom.query.profile.listPoints(profile);
for (const p of points) {
console.log(p.x, p.y, p.z);
}listCurves(profile)
List the curves that make up a profile. Host API call — mints fresh handles.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
CurveHandle[]— The profile's curves
ts
const curves = await snaptrude.core.geom.query.profile.listCurves(profile);getArea(profile)
Get the (approximate) enclosed area of a profile.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
number— The area, in Snaptrude units (seesnaptrude.core.units.convert(value, from, to))
getPerimeter(profile)
Get the perimeter (total curve length) of a profile.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
number— The perimeter, in Snaptrude units (seesnaptrude.core.units.convert(value, from, to))
getBoundingBox(profile)
Get the axis-aligned bounding box of a profile.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
BBoxComponents— The bounding box
getNormal(profile)
Get the unit normal vector of a profile's plane.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
Vec3Components | null— The normal, ornullif the profile has no well-defined normal
getNearestPoint(profile, point)
Get the point on a profile nearest to an arbitrary point.
- Parameters:
profile:ProfileHandle— The profile to querypoint:Vec3Handle— The reference point
- Returns:
Vec3Components— The nearest point on the profile
hasPoint(profile, point)
Test whether a point lies inside a profile.
- Parameters:
profile:ProfileHandle— The profile to querypoint:Vec3Handle— The point to test
- Returns:
boolean—trueif the point is inside the profile, otherwisefalse
ts
const point = await snaptrude.core.math.vec3.new(5, 0, 5);
const inside = await snaptrude.core.geom.query.profile.hasPoint(profile, point);isOnBoundary(profile, point)
Test whether a point lies on a profile's boundary.
- Parameters:
profile:ProfileHandle— The profile to querypoint:Vec3Handle— The point to test
- Returns:
boolean—trueif the point is on the boundary, otherwisefalse
isClosed(profile)
Test whether a profile forms a closed loop.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
boolean—trueif the profile is closed, otherwisefalse
isPlanar(profile)
Test whether a profile is planar.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
boolean—trueif the profile is planar, otherwisefalse
isClockwise(profile)
Test whether a profile is wound clockwise on the XZ plane.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
boolean—trueif the profile is clockwise, otherwisefalse
isSelfIntersecting(profile)
Test whether a profile intersects itself.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
boolean—trueif the profile is self-intersecting, otherwisefalse
isEmpty(profile)
Test whether a profile contains no curves.
- Parameters:
profile:ProfileHandle— The profile to query
- Returns:
boolean—trueif the profile is empty, otherwisefalse
isEqual(profileA, profileB)
Test whether two profiles are geometrically equal.
- Parameters:
profileA:ProfileHandle— First profileprofileB:ProfileHandle— Second profile
- Returns:
boolean—trueif the profiles are equal, otherwisefalse
Errors
Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:
| Code | Thrown by | When | details |
|---|---|---|---|
PRECONDITION_FAILED | getBoundingBox | The profile is empty — there are no points to bound | handles — the offending profile |
HANDLE_INVALID | all methods | The profile or point handle cannot be resolved | — |
Every other read is total — misses come back as data (getNormal → null), not as errors. Check isEmpty before asking an untrusted profile for its bounding box.