65 int a_leftShoulderIdx,
66 int a_rightShoulderIdx);
72 int a_leftShoulderIdx,
73 int a_rightShoulderIdx);
92 XmStampEndCapImpl::XmStampEndCapImpl()
98 XmStampEndCapImpl::~XmStampEndCapImpl()
112 bool firstEndCap(
true), lastEndCap(
false);
124 bool firstEndCap(
true), lastEndCap(
false);
142 int leftShoulderIdx(0), rightShoulderIdx(0);
143 VecPt3d *left(
nullptr), *right(
nullptr);
149 leftShoulderIdx = a_io.
m_cs[0].m_idxLeftShoulder;
151 rightShoulderIdx = a_io.
m_cs[0].m_idxRightShoulder;
157 left = &a_left.back();
158 leftShoulderIdx = a_io.
m_cs.back().m_idxLeftShoulder;
159 right = &a_right.back();
160 rightShoulderIdx = a_io.
m_cs.back().m_idxRightShoulder;
177 if (0.0 == a_angle || a_cs.empty())
182 double oldMag(0), oldAngle(0);
183 for (
size_t i = 0; i < a_cs.size(); ++i)
185 Pt3d p1(a_cs[i]), p2(p1);
192 double newAngle = oldAngle + a_angle;
194 double newMag = oldMag / cos(a_angle * (
XM_PI / 180.0));
198 a_cs[i].x = p2.x + p0.x;
199 a_cs[i].y = p2.y + p0.y;
220 int a_leftShoulderIdx,
221 int a_rightShoulderIdx)
228 GuidebankRotate(a_first, a_clPt, a_cap, a_left, a_right, a_leftShoulderIdx, a_rightShoulderIdx);
230 else if (1 == a_cap.
m_type)
261 int a_leftShoulderIdx,
262 int a_rightShoulderIdx)
264 XM_ENSURE_TRUE(static_cast<size_t>(a_leftShoulderIdx) < a_left.size());
265 XM_ENSURE_TRUE(static_cast<size_t>(a_rightShoulderIdx) < a_right.size());
267 Pt3d p0(a_clPt), p1(a_left[a_leftShoulderIdx - 1]), p2(a_right[a_rightShoulderIdx - 1]);
268 double leftWidth =
Mdist(p0.x, p0.y, p1.x, p1.y);
269 double rightWidth =
Mdist(p0.x, p0.y, p2.x, p2.y);
275 double gbAngle = a_cap.
m_angle;
276 double rightAngle(0), leftAngle(0);
277 if ((a_first && gbLeft) || (!a_first && !gbLeft))
279 rightAngle = atan(gbWidth / 2 / leftWidth) * 180.0 /
XM_PI;
280 leftAngle = -atan(gbWidth / 2 / rightWidth) * 180.0 /
XM_PI;
284 leftAngle = atan(gbWidth / 2 / leftWidth) * 180.0 /
XM_PI;
285 rightAngle = -atan(gbWidth / 2 / rightWidth) * 180.0 /
XM_PI;
288 double oldMag(0), oldAngle(0), newMag(0), newAngle(0);
290 for (
size_t i = 0; i < a_left.size(); ++i)
295 oldMag *= cos(gbAngle *
XM_PI / 180.0);
297 newAngle = oldAngle + gbAngle + leftAngle;
298 newMag = oldMag / cos((gbAngle + leftAngle) *
XM_PI / 180.0);
303 a_left[i].x = p2.x + p0.x;
304 a_left[i].y = p2.y + p0.y;
308 for (
size_t i = 0; i < a_right.size(); ++i)
310 p1 = a_right[i] - p0;
313 oldMag *= cos(gbAngle *
XM_PI / 180.0);
315 newAngle = oldAngle + gbAngle - rightAngle;
316 newMag = oldMag / cos((gbAngle - rightAngle) *
XM_PI / 180.0);
321 a_right[i].x = p2.x + p0.x;
322 a_right[i].y = p2.y + p0.y;
326 if ((a_first && gbLeft) || (!a_first && !gbLeft))
328 rightAngle = 45.0 - rightAngle;
329 leftAngle = -45.0 - leftAngle;
333 leftAngle = 45.0 - leftAngle;
334 rightAngle = -45.0 - rightAngle;
337 p0 = a_left[a_leftShoulderIdx - 1];
339 size_t start =
static_cast<size_t>(a_leftShoulderIdx);
340 for (
size_t i = start; i < a_left.size(); ++i)
345 oldMag *= cos(gbAngle *
XM_PI / 180.0);
347 newAngle = oldAngle + gbAngle + leftAngle;
348 newMag = oldMag / cos((gbAngle + leftAngle) *
XM_PI / 180.0);
353 a_left[i].x = p2.x + p0.x;
354 a_left[i].y = p2.y + p0.y;
357 p0 = a_right[a_rightShoulderIdx - 1];
359 start =
static_cast<size_t>(a_rightShoulderIdx);
360 for (
size_t i = start; i < a_right.size(); ++i)
362 p1 = a_right[i] - p0;
365 oldMag *= cos(gbAngle *
XM_PI / 180.0);
367 newAngle = oldAngle + gbAngle - rightAngle;
368 newMag = oldMag / cos((gbAngle - rightAngle) *
XM_PI / 180.0);
373 a_right[i].x = p2.x + p0.x;
374 a_right[i].y = p2.y + p0.y;
391 Pt3d p0 = a_cs[a_shoulderIdx - 1];
393 double oldMag(0), oldAngle(0);
394 size_t start =
static_cast<size_t>(a_shoulderIdx);
395 for (
size_t i = start; i < a_cs.size(); ++i)
397 Pt3d p1 = a_cs[i] - p0;
399 oldAngle -= a_capAngle;
400 oldMag *= cos(a_capAngle *
XM_PI / 180.0);
406 a_cs[i].x = p2.x + p0.x;
407 a_cs[i].y = p2.y + p0.y;
425 if (0 == a_capAngle && 0 == a_wwAngle)
432 Pt3d p0 = a_cs[a_shoulderIdx - 1];
434 double oldMag(0), oldAngle(0), newAngle(0), newMag(0);
435 size_t start =
static_cast<size_t>(a_shoulderIdx);
436 for (
size_t i = start; i < a_cs.size(); ++i)
438 Pt3d p1 = a_cs[i] - p0;
440 oldAngle -= a_capAngle;
441 oldMag *= cos(a_capAngle *
XM_PI / 180.0);
443 newAngle = oldAngle + a_capAngle + a_wwAngle;
444 newMag = oldMag / cos((a_capAngle + a_wwAngle) *
XM_PI / 180.0);
448 a_cs[i].x = p2.x + p0.x;
449 a_cs[i].y = p2.y + p0.y;
494 gb->DoConvertTo3d(a_first, a_io, a_3dpts);
508 sa->DoConvertTo3d(a_first, a_io, a_3dpts);
523 XmStampEndCap::XmStampEndCap()
529 XmStampEndCap::~XmStampEndCap()
static BSHP< XmGuideBankUtil > New()
Creates a XmStampInterpCrossSection class.
static BSHP< XmStampEndCap > New()
Creates a XmStampInterpCrossSection class.
VecPt3d2d m_right
3d locations of cross section points
stXs3dPts m_last_endcap
3d locations of the last end cap
XmStamperEndCap m_firstEndCap
end cap at beginnig of polyline
void GuidebankRotate(bool a_first, Pt3d &a_clPt, XmStamperEndCap &a_cap, VecPt3d &a_left, VecPt3d &a_right, int a_leftShoulderIdx, int a_rightShoulderIdx)
Rotates cross section points based on the angle specified for an end cap.
virtual void ConvertTo3dPts(XmStamperIo &a_io, XmStamper3dPts &a_3dpts) override
Rotates cross section points based on the angle specified for an end cap.
#define XM_ENSURE_TRUE_NO_ASSERT(...)
End cap definition for feature stamp.
static BSHP< XmSlopedAbutmentUtil > New()
Creates a XmSlopedAbutmentUtil class.
void EndCapTo3dPts(bool a_first, XmStamperIo &a_io, XmStamper3dPts &a_3dpts)
Converts an end cap to 3d pts defining the geometry.
End caps for feature stamping.
class to hold 3d points for a cross section
void RotateCrossSectionForType(bool a_first, Pt3d &a_clPt, XmStamperEndCap &a_cap, VecPt3d &a_left, VecPt3d &a_right, int a_leftShoulderIdx, int a_rightShoulderIdx)
Rotates cross section points based on the angle specified for an end cap.
XmStamperEndCap m_lastEndCap
end cap at end of polyline
void SlopedAbutmentEndCapTo3dPts(bool a_first, XmStamperIo &a_io, XmStamper3dPts &a_3dpts)
Converts an end cap to 3d pts defining the geometry.
#define XM_ENSURE_TRUE(...)
int m_side
position of guidebank relative to center line, 0-left, 1-right
void SlopedAbutmentRotateShoulders(double a_capAngle, int a_shoulderIdx, VecPt3d &a_cs)
Rotates cross section points based on the angle specified for an end cap.
XmWingWall m_wingWall
wing wall definition
XmGuidebank m_guidebank
guidebank definition
double m_wingWallAngle
degrees from 0 to 60
void gmComponentMagnitudes(double *a_x, double *a_y, double *a_mag, double *a_dir, bool a_tomagdir)
stXs3dPts m_first_endcap
3d locations of first end cap
class to hold 3d points generated by the stamping operation
int m_type
type of end cap: 0- guidebank, 1- sloped abutment, 2- wing wall
Stamping inputs/outputs class.
Implementaion of XmStampEndCap.
void GuidebankEndCapTo3dPts(bool a_first, XmStamperIo &a_io, XmStamper3dPts &a_3dpts)
Converts an end cap to 3d pts defining the geometry.
std::vector< VecPt3d > VecPt3d2d
void AdjustCrossSection(bool a_first, XmStamperIo &a_cap, VecPt3d2d &a_left, VecPt3d2d &a_right)
Rotates cross section points based on the angle specified for an end cap.
virtual void RotateEndCapCrossSections(XmStamperIo &a_io, VecPt3d2d &a_left, VecPt3d2d &a_right) override
Rotates cross section points based on the angle specified for an end cap.
std::vector< XmStampCrossSection > m_cs
cross sections along the polyLine
double Mdist(_T x1, _U y1, _V x2, _W y2)
VecPt3d2d m_left
3d locations of cross section points
double m_angle
degrees from -45 to 45
double m_width
width of guidebank about the center line
void WingWallRotate(bool a_first, double a_capAngle, double a_wwAngle, int a_shoulderIdx, VecPt3d &a_cs)
Rotates cross section points based on the angle specified for an end cap.
void RotateCrossSection(double a_angle, Pt3d &a_cl, VecPt3d &a_cs)
Rotates cross section points based on the angle specified for an end cap.
std::vector< Pt3d > VecPt3d