55 if (a_pts.size() < 2 || a_maxX <= 0.0)
64 for (
size_t i = 1; i < pts.size(); ++i)
66 double x2d = pts[i].
x;
69 p3d.x = a_cl.
x + x2d * cos(a_angle);
70 p3d.y = a_cl.
y + x2d * sin(a_angle);
82 for (
auto& v : a_xs.
m_left)
101 a_pts.push_back(
Pt3d(a_maxX, a_pts.front().y));
104 if (a_pts.back().x < a_maxX)
106 Pt3d p0(a_pts[a_pts.size() - 2]), p1(a_pts.back());
107 double t = (a_maxX - p0.x) / (p1.x - p0.x);
108 double z = p0.
y + t * (p1.y - p0.y);
109 a_pts.back() =
Pt3d(a_maxX, z);
113 if (a_pts.front().x > a_maxX)
116 vp[0] =
Pt3d(0, a_pts.front().y);
117 vp[1] =
Pt3d(a_maxX, vp[0].y);
124 for (
size_t i = 1; !done && i < a_pts.size(); ++i)
126 if (a_pts[i].x > a_maxX)
128 Pt3d p0(a_pts[i - 1]), p1(a_pts[i]);
129 double t = (a_maxX - p0.x) / (p1.
x - p0.x);
130 double z = p0.y + t * (p1.
y - p0.y);
136 else if (a_pts[i].x == a_maxX)
156 double& a_rightAngle)
158 a_leftAngle = a_rightAngle = 0;
167 Pt3d p1(a_cl[a_idx + 1]);
171 else if (a_cl.size() - 1 == a_idx)
173 Pt3d p1(a_cl[a_idx - 1]);
179 Pt3d p0(a_cl[a_idx - 1]);
180 Pt3d p1(a_cl[a_idx + 1]);
206 basePts = {{0, 6}, {3, 6}};
209 pts = {{5, 6}, {6, 7}, {7, 8}};
211 basePts = {{0, 6}, {3, 6}};
214 pts = {{5, 6}, {6, 7}, {7, 8}};
216 basePts = {{5, 6}, {6, 7}};
219 pts = {{0, 6}, {5, 6}, {15, 0}};
221 basePts = {{0, 6}, {5, 6}, {10, 3}};
224 pts = {{0, 6}, {5, 6}, {15, 0}};
226 basePts = {{0, 6}, {5, 6}, {20, -3}};
void test_EnsureVectorAtMaxX()
Tests XmUtilUnitTests.
VecPt3d m_left
left side of the cross section
double m_leftMax
max x value for left side
static void EnsureVectorAtMaxX(VecPt3d &a_pts, double a_maxX)
Makes sure the cross section goes to the maxX value.
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.
#define XM_ENSURE_TRUE(...)
double m_rightMax
max x value for right side
VecPt3d m_right
right side of the cross section
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...
std::vector< VecPt3d > VecPt3d2d
Cross section definition for stamping.
double gmPerpendicularAngle(const Pt3d &a_pt1, const Pt3d &a_pt2)
double gmBisectingAngle(const Pt3d &a_p1, const Pt3d &a_p2, const Pt3d &a_p3)
std::vector< Pt3d > VecPt3d
static void ScaleCrossSectionXvals(XmStampCrossSection &a_xs, double a_factor)
Converts interpolated cross sections to 3d.