53 VecInt& a_firstEndCapEndPts,
54 VecInt& a_lastEndCapEndPts,
58 VecInt& a_blTypes)
override;
85 XmGuideBankUtilImpl::XmGuideBankUtilImpl()
94 XmGuideBankUtilImpl::~XmGuideBankUtilImpl()
127 double angleFactor(1);
145 double relMajorAngle = (90.0 + cap.
m_angle) * angleFactor;
146 double relMinorAngle = 90.0 * angleFactor;
149 double mag(0), centerLineAngle(0);
153 double majorAngle = centerLineAngle + relMajorAngle;
156 double minorAngle = majorAngle + relMinorAngle;
166 double prevdx2(0), prevdy2(0.0);
168 for (
int iPt = 1; iPt < gb.
m_nPts; ++iPt)
172 double dx2(0), dy2(0);
175 pts[iPt].x = pts[iPt - 1].x + dx1 + (dx2 - prevdx2);
176 pts[iPt].y = pts[iPt - 1].y + dy1 + (dy2 - prevdy2);
182 pts.erase(pts.begin());
216 double halfWidth = gb.
m_width / 2;
218 auto myLambda = [](
double halfWidth,
int idx,
VecPt3d& v,
double& maxX) {
219 if (idx < (
int)v.size())
221 double oldHalfWidth = v[idx].x;
222 double factor = halfWidth / oldHalfWidth;
223 for (
int i = 0; i < idx; ++i)
227 factor = oldHalfWidth - halfWidth;
228 for (
int i = idx; i < (int)v.size(); ++i)
258 double leftAngle, rightAngle;
273 double leftLen = leftCs.m_leftMax;
274 double rightLen = rightCs.m_rightMax;
275 leftCs.m_idxRightShoulder = leftCs.m_idxLeftShoulder;
276 leftCs.m_right = leftCs.m_left;
277 leftCs.m_rightMax = leftCs.m_leftMax;
278 rightCs.m_idxLeftShoulder = rightCs.m_idxRightShoulder;
279 rightCs.m_left = rightCs.m_right;
280 rightCs.m_leftMax = rightCs.m_rightMax;
289 double mag(0), clAngle(0);
291 double startAngle = clAngle + (90.0 * factor);
296 pts.assign(v.size() - 1, p0);
297 for (
size_t i = 1; i < v.size(); ++i)
301 pts[i - 1].x = p0.x - (d.
x * factor);
302 pts[i - 1].y = p0.y - (d.
y * factor);
303 pts[i - 1].z = v[i].y;
310 std::vector<XmStampCrossSection> vCs(11);
311 double incr = 1.0 / 12.0, percent(0);
312 double angle = startAngle;
318 for (
int i = 0; i < 11; ++i)
324 vLen[i] = leftLen + percent * (leftLen - rightLen);
325 interp->InterpCs(leftCs, rightCs, percent, vCs[i]);
329 myLambda(pts, vCs[i].m_left, angle, p0, factor);
330 leftpts3d->push_back(pts);
341 VecInt& a_firstEndCapEndPts,
342 VecInt& a_lastEndCapEndPts,
346 auto myLambda_AddEndPtsForward = [](
VecInt& a_endPts,
VecInt2d& a_pts2d) {
347 auto it = a_pts2d.begin();
348 auto end = a_pts2d.end();
349 for (; it != end; ++it)
352 a_endPts.push_back(it->back());
355 auto myLambda_AddEndPtsReverse = [](
VecInt& a_endPts,
VecInt2d& a_pts2d) {
356 auto it = a_pts2d.rbegin();
357 auto end = a_pts2d.rend();
358 for (; it != end; ++it)
361 a_endPts.push_back(it->back());
364 auto myLambda_AddEndPtsLastXs = [](
VecInt& a_endPts,
int a_clPtIdx,
VecInt2d& a_pts2dReverse,
368 VecInt& pts(a_pts2dReverse.back());
369 auto it = pts.rbegin();
371 auto end = pts.rend();
372 a_endPts.insert(a_endPts.end(), it, end);
374 a_endPts.push_back(a_clPtIdx);
377 VecInt& pts(a_pts2dForward.back());
378 auto it = pts.begin();
379 auto end = pts.end();
381 a_endPts.insert(a_endPts.end(), it, end);
442 if (firstIsGuideBank)
450 bl.insert(bl.end(), beg, end);
452 a_blTypes.push_back(XmBreaklines::BL_CENTERLINE);
463 bl.insert(bl.end(), beg, end);
465 a_blTypes.push_back(XmBreaklines::BL_CENTERLINE);
482 VecInt bl, firstEndCapEndPts, lastEndCapEndPts;
488 if (firstIsGuideBank && !cl.empty())
492 auto beg = firstEndCapEndPts.begin();
494 bl.insert(bl.end(), beg, end);
496 a_blTypes.push_back(XmBreaklines::BL_END);
498 if (vl.size() > cl.size())
503 bl.insert(bl.end(), beg, end);
505 a_blTypes.push_back(XmBreaklines::BL_END);
510 end = firstEndCapEndPts.end();
511 bl.insert(bl.end(), beg, end);
514 a_blTypes.push_back(XmBreaklines::BL_END);
520 if (lastIsGuideBank && !cl.empty())
524 auto beg = lastEndCapEndPts.begin();
526 bl.insert(bl.end(), beg, end);
528 a_blTypes.push_back(XmBreaklines::BL_END);
530 if (vl.size() > cl.size())
535 bl.insert(bl.end(), beg, end);
537 a_blTypes.push_back(XmBreaklines::BL_END);
541 end = lastEndCapEndPts.end();
543 bl.insert(bl.end(), beg, end);
546 a_blTypes.push_back(XmBreaklines::BL_END);
564 if (firstIsGuideBank)
567 for (
size_t i = 0; i < v.size(); ++i)
574 bl.insert(bl.end(), beg, end);
582 bl.insert(bl.end(), beg, end);
585 a_blTypes.push_back(XmBreaklines::BL_XSECT);
591 for (
size_t i = 0; i < v.size(); ++i)
598 bl.insert(bl.end(), beg, end);
606 bl.insert(bl.end(), beg, end);
609 a_blTypes.push_back(XmBreaklines::BL_XSECT);
627 if (firstIsGuideBank)
631 if (v1.size() > v.size())
634 for (
size_t i = v.size(); i < v1.size(); ++i)
637 bl.push_back(v.back());
638 auto beg = v1[i].begin();
639 auto end = v1[i].end();
640 bl.insert(bl.end(), beg, end);
642 a_blTypes.push_back(XmBreaklines::BL_XSECT);
650 if (v1.size() > v.size())
653 for (
size_t i = v.size(); i < v1.size(); ++i)
656 bl.push_back(v.back());
657 auto beg = v1[i].begin();
658 auto end = v1[i].end();
659 bl.insert(bl.end(), beg, end);
661 a_blTypes.push_back(XmBreaklines::BL_XSECT);
688 int rShoulder(a_io.
m_cs.front().m_idxLeftShoulder - 1),
689 lShoulder(a_io.
m_cs.front().m_idxRightShoulder - 1);
693 for (
size_t i = 0; i < v.size(); ++i)
695 bl.push_back(v1[i][lShoulder]);
698 a_blTypes.push_back(XmBreaklines::BL_SHOULDER);
700 if (v1.size() > v.size())
703 for (
size_t i = v.size() - 1; i < v1.size(); ++i)
705 bl.push_back(v1[i][lShoulder]);
707 bl.push_back(vR.back()[rShoulder]);
709 a_blTypes.push_back(XmBreaklines::BL_SHOULDER);
714 for (
size_t i = 0; i < vR.size(); ++i)
716 bl.push_back(vR[i][rShoulder]);
719 a_blTypes.push_back(XmBreaklines::BL_SHOULDER);
728 int lShoulder(a_io.
m_cs.back().m_idxLeftShoulder - 1),
729 rShoulder(a_io.
m_cs.back().m_idxRightShoulder - 1);
733 for (
size_t i = 0; i < v.size(); ++i)
735 bl.push_back(v1[i][lShoulder]);
738 a_blTypes.push_back(XmBreaklines::BL_SHOULDER);
740 if (v1.size() > v.size())
743 for (
size_t i = v.size() - 1; i < v1.size(); ++i)
745 bl.push_back(v1[i][lShoulder]);
747 bl.push_back(vR.back()[rShoulder]);
749 a_blTypes.push_back(XmBreaklines::BL_SHOULDER);
754 for (
size_t i = 0; i < vR.size(); ++i)
756 bl.push_back(vR[i][rShoulder]);
759 a_blTypes.push_back(XmBreaklines::BL_SHOULDER);
766 XmGuideBankUtil::XmGuideBankUtil()
772 XmGuideBankUtil::~XmGuideBankUtil()
static BSHP< XmGuideBankUtil > New()
Creates a XmStampInterpCrossSection class.
virtual void GetEndCapEndPoints(cs3dPtIdx &a_ptIdx, VecInt &a_firstEndCapEndPts, VecInt &a_lastEndCapEndPts, XmStamperIo &a_io) override
creates a breakline representing the outer polygon of the stamp
virtual void GetEndCapBreakLines(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes) override
breaklines from the end cap
std::vector< int > VecInt
static BSHP< XmStampInterpCrossSection > New()
Creates a XmStampInterpCrossSection class.
void BreakLinesAddCrossSections(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes)
breaklines for cross sections
VecPt3d m_left
left side of the cross section
void GuideBankEndCap()
Makes the cross sections for the end cap of the guide bank.
VecPt3d2d m_right
3d locations of cross section points
void BreakLinesAddCenterLine(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes)
breaklines from the center line
int m_idxRightShoulder
index to the shoulder point in the m_right vector
void BreakLinesAddShoulders(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes)
breaklines for end cap
VecInt2d m_outBreakLines
break lines that are honored in the TIN
double m_radius2
second radius (R2) for guidebank creation
std::vector< double > VecDbl
XmStampCrossSection m_cs
cross section for the guidebank
VecInt m_centerLine
used by guidebank
Implementaion of XmGuideBankUtil.
stXs3dPts m_last_endcap
3d locations of the last end cap
XmStamperEndCap m_firstEndCap
end cap at beginnig of polyline
csPtIdx m_last_end_cap
helper struct to store point indexes
VecPt3d m_centerline
centerline for the guidebank
double gmConvertAngleToBetween0And360(double a_angle, bool a_InDegrees)
void CrossSectionTo3dPts()
Creates a cross section to be used for the guide bank.
double m_leftMax
max x value for left side
void AdjustEndCapCrossSection()
Creates a cross section to be used for the guide bank.
End cap definition for feature stamp.
static void EnsureVectorAtMaxX(VecPt3d &a_pts, double a_maxX)
Makes sure the cross section goes to the maxX value.
VecPt3d m_centerLine
only used by guidebank
Converts sloped abutment to 3d points.
std::vector< VecInt > VecInt2d
XmStamperEndCap m_lastEndCap
end cap at end of polyline
static void GetAnglesFromCenterLine(size_t a_idx, const VecPt3d &a_cl, double &a_leftAngle, double &a_rightAngle)
Gets the angles of the left and right cross sections relative to the centerline.
helper struct to store point indexes
#define XM_ENSURE_TRUE(...)
int m_side
position of guidebank relative to center line, 0-left, 1-right
void GuideBankCenterLine()
Creates the centerline for the guidebank.
void BreakLinesAddEndPoints(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes)
breaklines the outer edge of the stamp
void BreakLinesAddEndCap(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes)
breaklines for end cap
XmGuidebank m_guidebank
guidebank definition
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
double m_rightMax
max x value for right side
class to hold 3d points generated by the stamping operation
VecPt3d m_right
right side of the cross section
int m_type
type of end cap: 0- guidebank, 1- sloped abutment, 2- wing wall
XmStamper3dPts * m_3dpts
class that holds the 3d points from the stamp coversion
Stamping inputs/outputs class.
static void ConvertXsPointsTo3d(const Pt3d &a_cl, const VecPt3d &a_pts, double a_maxX, double a_angle, VecPt3d2d &a_3dpts)
Converts the left or right portion of a cross section data to 3d point locations using the angle from...
csPtIdx m_xsPts
helper struct to store point indexes
std::vector< VecPt3d > VecPt3d2d
virtual void DoConvertTo3d(bool a_first, XmStamperIo &a_io, XmStamper3dPts &a_3dpts) override
Converts an end cap to 3d pts defining the geometry.
Pt3d gmCreateVector(const Pt3d &a_p1, const Pt3d &a_p2)
csPtIdx m_first_end_cap
helper struct to store point indexes
int m_nPts
number of points created along the center line to create the guidebank
Cross section definition for stamping.
std::vector< XmStampCrossSection > m_cs
cross sections along the polyLine
VecPt3d2d m_left
3d locations of cross section points
double m_angle
degrees from -45 to 45
Guidebank definition for feature stamp end cap.
double m_width
width of guidebank about the center line
VecInt2d m_right
indexes of cross section points
VecInt2d m_left
indexes of cross section points
bool m_first
flag indicating if this is from the first end of the stamp
VecInt m_centerLine
indexes of cross section points
XmStamperIo * m_io
io class that has the stamping inputs
std::vector< Pt3d > VecPt3d
double m_radius1
first radius (R1) for guidebank creation
static void ScaleCrossSectionXvals(XmStampCrossSection &a_xs, double a_factor)
Converts interpolated cross sections to 3d.