MCPcopy Create free account
hub / github.com/Tencent/libpag / GetCubicLength

Function GetCubicLength

exporter/src/export/stream/StreamProperty.cpp:105–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static float GetCubicLength(float startX, float startY, float startZ, float controlX1,
106 float controlY1, float controlZ1, float controlX2, float controlY2,
107 float controlZ2, float endX, float endY, float endZ,
108 float precision = 0.005f) {
109 BezierPoint start(startX, startY, startZ);
110 BezierPoint control1(controlX1, controlY1, controlZ1);
111 BezierPoint control2(controlX2, controlY2, controlZ2);
112 BezierPoint end(endX, endY, endZ);
113 if (Point3DOnLine(start, end, control1, precision) &&
114 Point3DOnLine(start, end, control2, precision)) {
115 return Distance(start, end);
116 }
117 BezierPoint points[4] = {start, control1, control2, end};
118 return CaculateCubicLength(points, 0, 0, MaxBezierTValue, precision);
119}
120
121static float GetCurveLength(const AEGP_StreamValue2& lastValue, const AEGP_StreamValue2& lastOut,
122 const AEGP_StreamValue2& currentIn,

Callers 1

GetCurveLengthFunction · 0.85

Calls 3

CaculateCubicLengthFunction · 0.85
Point3DOnLineFunction · 0.70
DistanceFunction · 0.70

Tested by

no test coverage detected