38 const double QgsClipper::SMALL_NUM = 1e-12;
40 void QgsClipper::clipped3dLine(
const QVector< double > &xIn,
const QVector< double > &yIn,
const QVector<double> &zIn, QVector<double> &x, QVector<double> &y, QVector<double> &z,
const QgsBox3d &clipExtent )
42 double p0x, p0y, p0z, p1x = 0.0, p1y = 0.0, p1z = 0.0;
43 double p1x_c, p1y_c, p1z_c;
44 double lastClipX = 0.0, lastClipY = 0.0, lastClipZ = 0.0;
46 const int nPoints = xIn.size();
52 const double *sourceX = xIn.data();
53 const double *sourceY = yIn.data();
54 const double *sourceZ = zIn.data();
56 for (
int i = 0; i < nPoints; ++i )
79 if (
clipLineSegment( clipExtent, p0x, p0y, p0z, p1x_c, p1y_c, p1z_c ) )
81 bool newLine = !x.isEmpty() && ( !
qgsDoubleNear( p0x, lastClipX )
88 connectSeparatedLines( lastClipX, lastClipY, lastClipZ, p0x, p0y, p0z, clipExtent, x, y, z );
90 if ( x.isEmpty() || newLine )
117 const int nPoints = curve.size();
119 double p0x, p0y, p1x = 0.0, p1y = 0.0;
121 double lastClipX = 0.0, lastClipY = 0.0;
124 line.reserve( nPoints + 1 );
126 const QPointF *curveData = curve.data();
128 for (
int i = 0; i < nPoints; ++i )
132 p1x = curveData->x();
133 p1y = curveData->y();
140 p1x = curveData->x();
141 p1y = curveData->y();
146 p0x, p0y, p1x_c, p1y_c ) )
152 connectSeparatedLines( lastClipX, lastClipY, p0x, p0y, clipExtent, line );
154 if ( line.empty() || newLine )
157 line << QPointF( p0x, p0y );
163 line << QPointF( p1x_c, p1y_c );
171 void QgsClipper::connectSeparatedLines(
double x0,
double y0,
double x1,
double y1,
269 void QgsClipper::connectSeparatedLines(
double x0,
double y0,
double z0,
double x1,
double y1,
double z1,
270 const QgsBox3d &clipRect, QVector< double > &ptsX, QVector< double > &ptsY, QVector<double> &ptsZ )
273 double meanZ = ( z0 + z1 ) / 2.0;