Product Documentation
Virtuoso Studio Design Environment SKILL Reference
Product Version IC23.1, November 2023

ccGetCurveLength

ccGetCurveLength(
o_curve
[ n_discAccuracy ]
) 
=> n_length / nil

Description

Returns the approximate length of a curve or a polyCurve by discretizing it with the specified accuracy and summing up the lengths of the linear segments between the discretization points corrected by additional terms due to curvature.

The additional terms due to curvature are ds * (ds * (k1 + k2))^2 / 96, where ds is the length of the linear segment and k1 and k2 are the curvatures at the ends of the segment.

Arguments

o_curve

ID of a ccCurve or a ccPolyCurve

n_discAccuracy

Discretization accuracy specifying the maximum deviation of the linear segments between the discretization points from the actual curve. The default value is 0.01.

Value Returned

n_length

The approximate length of a curve or a polyCurve.

nil

An error occurred.

Example

c=ccCreateCurve("10*C(t/10)" "10*S(t/10)" 0.2:1.2)
cc@0x6db5618c
printf("%.16g\n" ccGetCurveLength(c 0.0001))
0.9999999996324054

Related Topics

Curvy Core Mathematical Object Attribute Query Functions


Return to top
 ⠀
X