本文整理汇总了C++中Point3::rotateZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3::rotateZ方法的具体用法?C++ Point3::rotateZ怎么用?C++ Point3::rotateZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3::rotateZ方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void Renderer2D::drawListOfTriangleSets(const vector<hesperia::decorator::models::TriangleSet> &listOfTriangleSets, const hesperia::data::environment::Point3 &position, const hesperia::data::environment::Point3 &rotation) {
vector<TriangleSet>::const_iterator it = listOfTriangleSets.begin();
while (it != listOfTriangleSets.end()) {
if ((*it).m_vertices.size() > 0) {
setColor((*it).m_material.getDiffuse());
setLineWidth(1.0);
// Fix inside OBJ-Wavefront-Models (OBJXArchive) (rotated 90°)!
vector<Point3> vertices = (*it).m_vertices;
vector<Point3> rotatedVertices;
vector<Point3>::iterator jt = vertices.begin();
while (jt != vertices.end()) {
Point3 p = (*jt).rotateX(cartesian::Constants::PI/2.0);
p.rotateX(rotation.getX());
p.rotateY(rotation.getY());
p.rotateZ(rotation.getZ());
p += position;
rotatedVertices.push_back(p);
jt++;
}
drawPolyLine(rotatedVertices);
}
it++;
}
}
示例2: transformInversely
Point3 Transformation::transformInversely(const Point3 &coordinate, const Position &position) const {
Point3 cc = coordinate;
// Rotate the coordinate.
cc.rotateX(-1 * position.getRotation().getX());
cc.rotateY(-1 * position.getRotation().getY());
cc.rotateZ(-1 * position.getRotation().getZ());
// Translate the coordinate.
cc -= position.getPosition();
return cc;
}
示例3: 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();
}
}
}
}