本文整理汇总了C++中Point3::normalizeXY方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3::normalizeXY方法的具体用法?C++ Point3::normalizeXY怎么用?C++ Point3::normalizeXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3::normalizeXY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitPointModel
void ScenarioRenderer::visitPointModel(PointModel &pointModel) {
Lock l(m_scenarioRendererMutex);
if (m_renderer != NULL) {
if ( (pointModel.getLane() != NULL) && (pointModel.getLane()->getRoad() != NULL) && (pointModel.getLane()->getRoad()->getLayer() != NULL) ) {
const vector<IDVertex3> &listOfVertices = pointModel.getListOfIdentifiableVertices();
const uint32_t SIZE = listOfVertices.size();
if (SIZE > 1) {
m_renderer->beginPainting();
for (uint32_t i = 0; i < (SIZE-1); i++) {
// Get to adjacent vertices, determine direction, construct orthogonal direction
Point3 ptA = listOfVertices.at(i);
ptA.setZ(pointModel.getLane()->getRoad()->getLayer()->getHeight());
Point3 ptB = listOfVertices.at(i+1);
ptB.setZ(pointModel.getLane()->getRoad()->getLayer()->getHeight());
// Label Waypoints.
stringstream namePtA;
namePtA << pointModel.getLane()->getRoad()->getLayer()->getID() << "." << pointModel.getLane()->getRoad()->getID() << "." << pointModel.getLane()->getID() << "." << listOfVertices.at(i).getID();
m_renderer->setColor(Point3(0.7, 0.7, 0.7));
m_renderer->drawText(ptA, namePtA.str());
stringstream namePtB;
namePtB << pointModel.getLane()->getRoad()->getLayer()->getID() << "." << pointModel.getLane()->getRoad()->getID() << "." << pointModel.getLane()->getID() << "." << listOfVertices.at(i+1).getID();
m_renderer->setColor(Point3(0.7, 0.7, 0.7));
m_renderer->drawText(ptB, namePtB.str());
m_renderer->setColor(Point3(1, 0, 0));
m_renderer->setPointWidth(5);
m_renderer->drawPoint(ptA);
m_renderer->drawPoint(ptB);
Point3 colorSkeleton(0.2, 0.2, 0.2);
m_renderer->setColor(colorSkeleton);
m_renderer->setLineWidth(1);
m_renderer->drawLine(ptA, ptB);
const double halfWidth = pointModel.getLaneAttribute().getWidth() / 2.0;
if (halfWidth > 1) {
Point3 orthonormalDirection = (ptB - ptA);
orthonormalDirection.normalizeXY();
orthonormalDirection.setZ(0);
orthonormalDirection.rotateZ(cartesian::Constants::PI/2.0);
Point3 colorLeftMarking;
switch (pointModel.getLaneAttribute().getLeftLaneMarking()) {
case LaneAttribute::SOLID_YELLOW:
case LaneAttribute::DOUBLE_YELLOW:
colorLeftMarking = Point3(1, 1, 0);
break;
case LaneAttribute::BROKEN_WHITE:
case LaneAttribute::SOLID_WHITE:
colorLeftMarking = Point3(1, 1, 1);
break;
case LaneAttribute::UNDEFINED:
case LaneAttribute::CROSSWALK:
colorLeftMarking = Point3(0.3, 0.3, 0.3);
break;
}
Point3 leftLanePtA = ptA + (orthonormalDirection * halfWidth);
Point3 leftLanePtB = ptB + (orthonormalDirection * halfWidth);
m_renderer->setColor(colorLeftMarking);
m_renderer->setLineWidth(5);
m_renderer->drawLine(leftLanePtA, leftLanePtB);
// Draw right lane marking.
Point3 colorRightMarking;
switch (pointModel.getLaneAttribute().getRightLaneMarking()) {
case LaneAttribute::SOLID_YELLOW:
case LaneAttribute::DOUBLE_YELLOW:
colorRightMarking = Point3(1, 1, 0);
break;
case LaneAttribute::BROKEN_WHITE:
case LaneAttribute::SOLID_WHITE:
colorRightMarking = Point3(1, 1, 1);
break;
case LaneAttribute::UNDEFINED:
case LaneAttribute::CROSSWALK:
colorRightMarking = Point3(0.3, 0.3, 0.3);
break;
}
Point3 rightLanePtA = ptA - (orthonormalDirection * halfWidth);
Point3 rightLanePtB = ptB - (orthonormalDirection * halfWidth);
m_renderer->setColor(colorRightMarking);
m_renderer->setLineWidth(5);
m_renderer->drawLine(rightLanePtA, rightLanePtB);
}
}
m_renderer->endPainting();
}
}
}
}