Skip to content

useEdgeLength

Takes an edge and returns the total length of the edge. As edges are comprised of one or more line and/or curve segments, it also returns the length of each segment in the edge as a separate array. Typically, you're only going to need the length property.

Configuration

PropertyDefaultDescription
edgeA single Edge from a primitive.

Usage

js
const square = useSquare({sideLength: 100})
const {length, segmentLengths} = useEdgeLength(square.edges.value[0])

Returns

PropertyType DeclarationDescription
lengthComputedRef<number>The length of the whole edge of a primitive (most commonly used)
segmentLengthsComputedRef<number[]>The length of each segment in the edge, if an edge has multiple line and/or curve segments

Released under the MIT License.