本文整理汇总了C++中Transformation类的典型用法代码示例。如果您正苦于以下问题:C++ Transformation类的具体用法?C++ Transformation怎么用?C++ Transformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transformation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(GeometryFixture, TranslationTransformations)
{
double tol = 1.0E-12;
Vector3d trans(1,1,1);
Point3d point1(1,0,0);
Transformation T;
Point3d temp;
// identity transformation
temp = T*point1;
EXPECT_NEAR(1.0, temp.x(), tol);
EXPECT_NEAR(0.0, temp.y(), tol);
EXPECT_NEAR(0.0, temp.z(), tol);
// move by 1, 1, 1
T = Transformation::translation(trans);
temp = T*point1;
EXPECT_NEAR(2.0, temp.x(), tol);
EXPECT_NEAR(1.0, temp.y(), tol);
EXPECT_NEAR(1.0, temp.z(), tol);
// move by -1, -1, -1
temp = T.inverse()*point1;
EXPECT_NEAR(0.0, temp.x(), tol);
EXPECT_NEAR(-1.0, temp.y(), tol);
EXPECT_NEAR(-1.0, temp.z(), tol);
// identity transformation
temp = T.inverse()*T*point1;
EXPECT_NEAR(1.0, temp.x(), tol);
EXPECT_NEAR(0.0, temp.y(), tol);
EXPECT_NEAR(0.0, temp.z(), tol);
// identity transformation
temp = T*T.inverse()*point1;
EXPECT_NEAR(1.0, temp.x(), tol);
EXPECT_NEAR(0.0, temp.y(), tol);
EXPECT_NEAR(0.0, temp.z(), tol);
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:39,代码来源:Transformation_GTest.cpp
示例2: loadYRadiusValuesForCurveRaw
void ExportFileFunctions::loadYRadiusValuesForCurveRaw (const DocumentModelCoords &modelCoords,
const MainWindowModel &modelMainWindow,
const Points &points,
const ExportValuesXOrY &xThetaValues,
const Transformation &transformation,
QVector<QString*> &yRadiusValues) const
{
LOG4CPP_INFO_S ((*mainCat)) << "ExportFileFunctions::loadYRadiusValuesForCurveRaw";
FormatCoordsUnits format;
// Since the curve points may be a subset of xThetaValues (in which case the non-applicable xThetaValues will have
// blanks for the yRadiusValues), we iterate over the smaller set
for (int pt = 0; pt < points.count(); pt++) {
const Point &point = points.at (pt);
QPointF posGraph;
transformation.transformScreenToRawGraph (point.posScreen(),
posGraph);
// Find the closest point in xThetaValues. This is probably an N-squared algorithm, which is less than optimial,
// but the delay should be insignificant with normal-sized export files
double closestSeparation = 0.0;
int rowClosest = 0;
for (int row = 0; row < xThetaValues.count(); row++) {
double xThetaValue = xThetaValues.at (row);
double separation = qAbs (posGraph.x() - xThetaValue);
if ((row == 0) ||
(separation < closestSeparation)) {
closestSeparation = separation;
rowClosest = row;
}
}
// Save y/radius value for this row into yRadiusValues, after appropriate formatting
QString dummyXThetaOut;
format.unformattedToFormatted (posGraph.x(),
posGraph.y(),
modelCoords,
modelMainWindow,
dummyXThetaOut,
*(yRadiusValues [rowClosest]),
transformation);
}
}
开发者ID:m2pathan,项目名称:engauge-digitizer,代码行数:51,代码来源:ExportFileFunctions.cpp
示例3: assert
void Sim3Model
::calc_motion(const StereoCamera & cam,
const ALIGNED<Vector3d>::vector & query_obs_vec,
const ALIGNED<Vector3d>::vector & train_pt_vec,
Transformation & sim3)
{
assert(query_obs_vec.size()==num_points);
assert(train_pt_vec.size()==num_points);
// get centroids
Vector3d p0a = cam.unmap_uvu(query_obs_vec[0]);
Vector3d p0b = cam.unmap_uvu(query_obs_vec[1]);
Vector3d p0c = cam.unmap_uvu(query_obs_vec[2]);
Vector3d p1a = train_pt_vec[0];
Vector3d p1b = train_pt_vec[1];
Vector3d p1c = train_pt_vec[2];
Vector3d c0, c1;
Matrix3d R
= AbsoluteOrientation::getOrientationAndCentriods(p0a,
p0b,
p0c,
p1a,
p1b,
p1c,
c0,
c1);
sim3.set_rotation_matrix(R);
sim3.scale() =
sqrt(p0a.squaredNorm()
+ p0b.squaredNorm()
+ p0c.squaredNorm())
/
sqrt((R*p1a).squaredNorm()
+ (R*p1b).squaredNorm()
+ (R*p1c).squaredNorm());
sim3.translation() = c0-sim3.scale()*R*c1;
}
开发者ID:nttputus,项目名称:ScaViSLAM,代码行数:38,代码来源:ransac_models.cpp
示例4: mapAndMultTest
bool mapAndMultTest() {
bool passed = true;
for (size_t i=0; i<group_vec_.size(); ++i) {
for (size_t j=0; j<group_vec_.size(); ++j) {
Transformation mul_resmat = (group_vec_[i]*group_vec_[j]).matrix();
Scalar fastmul_res_raw[LieGroup::num_parameters];
Eigen::Map<LieGroup> fastmul_res(fastmul_res_raw);
Eigen::Map<const LieGroup> group_j_constmap(group_vec_[j].data());
fastmul_res = group_vec_[i];
fastmul_res.fastMultiply(group_j_constmap);
Transformation diff = mul_resmat-fastmul_res.matrix();
Scalar nrm = diff.norm();
if (isnan(nrm) || nrm>SMALL_EPS) {
cerr << "Map & Multiply" << endl;
cerr << "Test case: " << i << "," << j << endl;
cerr << diff <<endl;
cerr << endl;
passed = false;
}
}
}
return passed;
}
开发者ID:Adam-Strupczewski,项目名称:LSDSlam,代码行数:23,代码来源:tests.hpp
示例5: requestState
bool DefaultLocalizer::fetch( const std::string& port, Transformation& out )
{
requestState( ready );
std::vector< CToolData* > tdv;
CToolData td;
td.bVisible = false;
td.setSzPort( port );
tdv.push_back( &td );
pimpl->localizer.getToolData( tdv );
if( td.isVisible() )
{
for( int i = 0; i < 3; ++i )
for( int j = 0; j < 3; ++j )
{
out.getTransformationMatrix()( i, j ) = td.mR( i, j );
}
for( int i = 0; i < 3; ++i )
{
out.getTransformationMatrix()( i, 3 ) = td.vT( i );
}
out.a44() = 1;
return true;
}
else
{
return false;
}
}
开发者ID:RWTHmediTEC,项目名称:CRA,代码行数:37,代码来源:DefaultLocalizer.cpp
示例6: asin
void TurntableCamera<real>::Update()
{
Transformation<real> transformation;
Vector3<real> initRotationAxis = Vector3<real>( 0, 1, 0 ) ^ mThetaAxis;
if ( initRotationAxis.SquaredLength() > 1e-5 )
transformation.SetRotationAxis( initRotationAxis.Normalized(), asin( initRotationAxis.Length() ) );
transformation.RotateAxis( mPhiAxis, mPhi );
transformation.RotateAxis( mThetaAxis, mTheta );
Transformation<real> transformationT;
transformationT.RotateAxis( mPhiAxis, mPhi );
transformationT.RotateAxis( mThetaAxis, mTheta );
transformation.SetTranslation( transformationT.GetRotation() * ( mPhiAxis ^ mThetaAxis ).Normalized() * mDistance + mCenter );
this->SetLocalTransformation( transformation );
Camera<real>::Update();
}
开发者ID:gnuvince,项目名称:ift3355-tp1,代码行数:20,代码来源:TurntableCamera.cpp
示例7: updateGraphicsLinesToMatchGraphicsPoints
void GraphicsScene::updateGraphicsLinesToMatchGraphicsPoints (const CurveStyles &curveStyles,
const Transformation &transformation)
{
LOG4CPP_INFO_S ((*mainCat)) << "GraphicsScene::updateGraphicsLinesToMatchGraphicsPoints";
if (transformation.transformIsDefined()) {
// Ordinals must be updated to reflect reordering that may have resulted from dragging points
m_graphicsLinesForCurves.updatePointOrdinalsAfterDrag (curveStyles,
transformation);
// Recompute the lines one time for efficiency
m_graphicsLinesForCurves.updateGraphicsLinesToMatchGraphicsPoints (curveStyles);
}
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例8: LOG4CPP_INFO_S
void Checker::prepareForDisplay (const QPolygonF &polygon,
int pointRadius,
const DocumentModelAxesChecker &modelAxesChecker,
const DocumentModelCoords &modelCoords,
DocumentAxesPointsRequired documentAxesPointsRequired)
{
LOG4CPP_INFO_S ((*mainCat)) << "Checker::prepareForDisplay";
ENGAUGE_ASSERT ((polygon.count () == NUM_AXES_POINTS_3) ||
(polygon.count () == NUM_AXES_POINTS_4));
// Convert pixel coordinates in QPointF to screen and graph coordinates in Point using
// identity transformation, so this routine can reuse computations provided by Transformation
QList<Point> points;
QPolygonF::const_iterator itr;
for (itr = polygon.begin (); itr != polygon.end (); itr++) {
const QPointF &pF = *itr;
Point p (DUMMY_CURVE_NAME,
pF,
pF,
false);
points.push_back (p);
}
// Screen and graph coordinates are treated as the same, so identity transform is used
Transformation transformIdentity;
transformIdentity.identity();
prepareForDisplay (points,
pointRadius,
modelAxesChecker,
modelCoords,
transformIdentity,
documentAxesPointsRequired);
}
开发者ID:TobiasWinchen,项目名称:engauge_debian,代码行数:36,代码来源:Checker.cpp
示例9: reorderULC
/// reorder points to upper-left-corner convention
Point3dVector reorderULC(const Point3dVector& points)
{
unsigned N = points.size();
if (N < 3){
return Point3dVector();
}
// transformation to align face
Transformation t = Transformation::alignFace(points);
Point3dVector facePoints = t.inverse()*points;
// find ulc index in face coordinates
double maxY = std::numeric_limits<double>::min();
double minX = std::numeric_limits<double>::max();
unsigned ulcIndex = 0;
for(unsigned i = 0; i < N; ++i){
OS_ASSERT(std::abs(facePoints[i].z()) < 0.001);
if ((maxY < facePoints[i].y()) || ((maxY < facePoints[i].y() + 0.00001) && (minX > facePoints[i].x()))){
ulcIndex = i;
maxY = facePoints[i].y();
minX = facePoints[i].x();
}
}
// no-op
if (ulcIndex == 0){
return points;
}
// create result
Point3dVector result;
std::copy (points.begin() + ulcIndex, points.end(), std::back_inserter(result));
std::copy (points.begin(), points.begin() + ulcIndex, std::back_inserter(result));
OS_ASSERT(result.size() == N);
return result;
}
开发者ID:joshwentz,项目名称:OpenStudio,代码行数:37,代码来源:Geometry.cpp
示例10: Impl
//---------------------------------------------------------------------------
Impl(ColisionShapeType::Enum e, const Transformation& t, MeshObjectPtr colMesh)
: mColShape(e)
, mColMesh(colMesh)
, mTransformation(t)
{
switch (e)
{
case ColisionShapeType::SPHERE:
{
mBV = BoundingVolume::Create(BoundingVolume::BV_SPHERE);
auto scale = t.GetScale();
if (scale.x != scale.z || scale.x != scale.y)
{
Logger::Log(FB_ERROR_LOG_ARG, "Collision Sphere should be uniform scaled!");
assert(0);
}
mBV->SetRadius(1 * t.GetScale().x);
mBV->SetCenter(Vec3::ZERO);
}
break;
case ColisionShapeType::CUBE:
{
mBV = BoundingVolume::Create(BoundingVolume::BV_AABB);
AABB aabb;
aabb.SetMax(Vec3(1, 1, 1) * t.GetScale());
aabb.SetMin(Vec3(-1, -1, -1) * t.GetScale());
BVaabb* bvaabb = (BVaabb*)mBV.get();
bvaabb->SetAABB(aabb);
}
break;
default:
break;
}
}
开发者ID:wangscript,项目名称:fastbirdEngine,代码行数:37,代码来源:FBCollisionShape.cpp
示例11: quaternion
/**
* \brief Setter of quaternion using scaled rotation matrix
*
* \param sR a 3x3 scaled rotation matrix
* \pre the 3x3 matrix should be "scaled orthogonal"
* and have a positive determinant
*/
inline
void setScaledRotationMatrix
(const Transformation & sR) {
Transformation squared_sR = sR*sR.transpose();
Scalar squared_scale
= static_cast<Scalar>(1./3.)
*(squared_sR(0,0)+squared_sR(1,1)+squared_sR(2,2));
SOPHUS_ENSURE(squared_scale > static_cast<Scalar>(0),
"Scale factor should be positive");
Scalar scale = std::sqrt(squared_scale);
SOPHUS_ENSURE(scale > static_cast<Scalar>(0),
"Scale factor should be positive");
quaternion() = sR/scale;
quaternion().coeffs() *= scale;
}
开发者ID:janjachnik,项目名称:Sophus,代码行数:22,代码来源:rxso3.hpp
示例12:
std::vector<FVector3> PointCloud::GetTransformedPositions(const Transformation& transformation) const
{
std::vector<FVector3> transformedPositions;
if (positions.size() > 0)
{
transformedPositions.reserve(positions.size());
for (const FVector3& position : positions)
{
transformedPositions.push_back(transformation.MultVertex(position));
}
}
return transformedPositions;
}
开发者ID:ShacharAvni,项目名称:Locus-Game-Engine,代码行数:16,代码来源:PointCloud.cpp
示例13: remove
QPixmap GridRemoval::remove (const Transformation &transformation,
const DocumentModelGridRemoval &modelGridRemoval,
const QImage &imageBefore)
{
LOG4CPP_INFO_S ((*mainCat)) << "GridRemoval::remove"
<< " transformationIsDefined=" << (transformation.transformIsDefined() ? "true" : "false")
<< " removeDefinedGridLines=" << (modelGridRemoval.removeDefinedGridLines() ? "true" : "false");
QImage image = imageBefore;
// Make sure grid line removal is wanted, and possible. Otherwise all processing is skipped
if (modelGridRemoval.removeDefinedGridLines() &&
transformation.transformIsDefined()) {
double yGraphMin = modelGridRemoval.startY();
double yGraphMax = modelGridRemoval.stopY();
for (int i = 0; i < modelGridRemoval.countX(); i++) {
double xGraph = modelGridRemoval.startX() + i * modelGridRemoval.stepX();
// Convert line between graph coordinates (xGraph,yGraphMin) and (xGraph,yGraphMax) to screen coordinates
QPointF posScreenMin, posScreenMax;
transformation.transformRawGraphToScreen (QPointF (xGraph,
yGraphMin),
posScreenMin);
transformation.transformRawGraphToScreen (QPointF (xGraph,
yGraphMax),
posScreenMax);
removeLine (posScreenMin,
posScreenMax,
image);
}
double xGraphMin = modelGridRemoval.startX();
double xGraphMax = modelGridRemoval.stopX();
for (int j = 0; j < modelGridRemoval.countY(); j++) {
double yGraph = modelGridRemoval.startY() + j * modelGridRemoval.stepY();
// Convert line between graph coordinates (xGraphMin,yGraph) and (xGraphMax,yGraph) to screen coordinates
QPointF posScreenMin, posScreenMax;
transformation.transformRawGraphToScreen (QPointF (xGraphMin,
yGraph),
posScreenMin);
transformation.transformRawGraphToScreen (QPointF (xGraphMax,
yGraph),
posScreenMax);
removeLine (posScreenMin,
posScreenMax,
image);
}
}
return QPixmap::fromImage (image);
}
开发者ID:thurberdog,项目名称:engauge6,代码行数:55,代码来源:GridRemoval.cpp
示例14: linearlyInterpolate
double ExportFileFunctions::linearlyInterpolate (const Points &points,
double xThetaValue,
const Transformation &transformation) const
{
LOG4CPP_INFO_S ((*mainCat)) << "ExportFileFunctions::linearlyInterpolate";
double yRadius = 0;
QPointF posGraphBefore; // Not set until ip=1
bool foundIt = false;
for (int ip = 0; ip < points.count(); ip++) {
const Point &point = points.at (ip);
QPointF posGraph;
transformation.transformScreenToRawGraph (point.posScreen(),
posGraph);
if (xThetaValue <= posGraph.x()) {
foundIt = true;
if (ip == 0) {
// Use first point
yRadius = posGraph.y();
} else {
// Between posGraphBefore and posGraph. Note that if posGraph.x()=posGraphBefore.x() then
// previous iteration of loop would have been used for interpolation, and then the loop was exited
double s = (xThetaValue - posGraphBefore.x()) / (posGraph.x() - posGraphBefore.x());
yRadius = (1.0 -s) * posGraphBefore.y() + s * posGraph.y();
}
break;
}
posGraphBefore = posGraph;
}
if (!foundIt) {
// Use last point
yRadius = posGraphBefore.y();
}
return yRadius;
}
开发者ID:m2pathan,项目名称:engauge-digitizer,代码行数:47,代码来源:ExportFileFunctions.cpp
示例15: DrawPrimitiveQuad
void DrawPrimitiveQuad(Transformation &QuadTransformation, const EBlendMode &Mode, const ColorRGB &Color)
{
Image::BindNull();
WindowFrame.SetUniform(U_COLOR, Color.Red, Color.Green, Color.Blue, Color.Alpha);
SetBlendingMode(Mode);
Mat4 Mat = QuadTransformation.GetMatrix();
WindowFrame.SetUniform(U_MVP, &(Mat[0][0]));
// Assign position attrib. pointer
SetPrimitiveQuadVBO();
DoQuadDraw();
FinalizeDraw();
Image::ForceRebind();
}
开发者ID:alexanderkunz,项目名称:raindrop,代码行数:17,代码来源:Rendering.cpp
示例16: switch
void SceneNode::addTransformation(const Transformation& Trans)
{
switch(Trans.getTransformationType()) {
case Transformation::Translate:
m_Transformations.push_back(new Translate((Translate&)Trans));
break;
case Transformation::Scale:
m_Transformations.push_back(new Scale((Scale&)Trans));
break;
case Transformation::Rotate:
m_Transformations.push_back(new Rotate((Rotate&)Trans));
break;
case Transformation::Matrix:
m_Transformations.push_back(new Matrix((Matrix&)Trans));
break;
}
}
开发者ID:ClementLeBihan,项目名称:CelluleFlexible,代码行数:17,代码来源:SceneNode.cpp
示例17: finishActiveSegment
void Checker::finishActiveSegment (const DocumentModelCoords &modelCoords,
const QPointF &posStartScreen,
const QPointF &posEndScreen,
double yFrom,
double yTo,
const Transformation &transformation,
SideSegments &sideSegments) const
{
LOG4CPP_INFO_S ((*mainCat)) << "Checker::finishActiveSegment"
<< " posStartScreen=" << QPointFToString (posStartScreen).toLatin1().data()
<< " posEndScreen=" << QPointFToString (posEndScreen).toLatin1().data()
<< " yFrom=" << yFrom
<< " yTo=" << yTo;
QGraphicsItem *item;
if ((modelCoords.coordsType() == COORDS_TYPE_POLAR) &&
(yFrom == yTo)) {
// Linear cartesian radius
double radiusLinearCartesian = yFrom;
if (modelCoords.coordScaleYRadius() == COORD_SCALE_LOG) {
radiusLinearCartesian = transformation.logToLinearRadius(yFrom,
modelCoords.originRadius());
} else {
radiusLinearCartesian -= modelCoords.originRadius();
}
// Draw along an arc since this is a side of constant radius, and we have polar coordinates
item = ellipseItem (transformation,
radiusLinearCartesian,
posStartScreen,
posEndScreen);
} else {
// Draw straight line
item = lineItem (posStartScreen,
posEndScreen);
}
sideSegments.push_back (item);
bindItemToScene (item);
}
开发者ID:thurberdog,项目名称:engauge6,代码行数:43,代码来源:Checker.cpp
示例18: finishActiveGridLine
void GridLineFactory::finishActiveGridLine (const QPointF &posStartScreen,
const QPointF &posEndScreen,
double yFrom,
double yTo,
const Transformation &transformation,
GridLine &gridLine) const
{
LOG4CPP_DEBUG_S ((*mainCat)) << "GridLineFactory::finishActiveGridLine"
<< " posStartScreen=" << QPointFToString (posStartScreen).toLatin1().data()
<< " posEndScreen=" << QPointFToString (posEndScreen).toLatin1().data()
<< " yFrom=" << yFrom
<< " yTo=" << yTo;
QGraphicsItem *item;
if ((m_modelCoords.coordsType() == COORDS_TYPE_POLAR) &&
(yFrom == yTo)) {
// Linear cartesian radius
double radiusLinearCartesian = yFrom;
if (m_modelCoords.coordScaleYRadius() == COORD_SCALE_LOG) {
radiusLinearCartesian = transformation.logToLinearRadius(yFrom,
m_modelCoords.originRadius());
} else {
radiusLinearCartesian -= m_modelCoords.originRadius();
}
// Draw along an arc since this is a side of constant radius, and we have polar coordinates
item = ellipseItem (transformation,
radiusLinearCartesian,
posStartScreen,
posEndScreen);
} else {
// Draw straight line
item = lineItem (posStartScreen,
posEndScreen);
}
gridLine.add (item);
bindItemToScene (item);
}
开发者ID:TobiasWinchen,项目名称:engauge-digitizer,代码行数:42,代码来源:GridLineFactory.cpp
示例19:
/* ------------------------------------------------------- */
Transformation Transformation::operator*(const Transformation& t)
{
if (m_isIdentity)
{
return t;
}
if (t.m_isIdentity)
{
return *this;
}
Transformation result;
if (m_isRSMatrix && t.m_isRSMatrix)
{
if (m_isUniformScale)
{
result.setRotation(m_matrix * t.m_matrix);
result.setTranslation(m_scale[0]*(m_matrix*t.m_translate) + m_translate);
if (t.m_isUniformScale)
{
result.setUniformScale(m_scale[0] * t.m_scale[0]);
}
else
{
result.setScale(m_scale[0] * t.m_scale);
}
return result;
}
}
// In all remaining cases, the matrix cannot be written as R*S*X+T.
Matrix3 a = ( m_isRSMatrix ?
m_matrix.timesDiagonal(m_scale) :
m_matrix );
Matrix3 b = ( t.m_isRSMatrix ?
t.m_matrix.timesDiagonal(t.m_scale) :
t.m_matrix );
result.setMatrix(a*b);
result.setTranslation(a*t.m_translate + m_translate);
return result;
}
开发者ID:widmoser,项目名称:lotus,代码行数:45,代码来源:lspatial.cpp
示例20: LOG4CPP_INFO_S
void ExportOrdinalsSmooth::loadSplinePairsWithTransformation (const Points &points,
const Transformation &transformation,
vector<double> &t,
vector<SplinePair> &xy) const
{
LOG4CPP_INFO_S ((*mainCat)) << "ExportOrdinalsSmooth::loadSplinePairsWithTransformation";
Points::const_iterator itrP;
for (itrP = points.begin(); itrP != points.end(); itrP++) {
const Point &point = *itrP;
QPointF posScreen = point.posScreen();
QPointF posGraph;
transformation.transformScreenToRawGraph (posScreen,
posGraph);
t.push_back (point.ordinal ());
xy.push_back (SplinePair (posGraph.x(),
posGraph.y()));
}
}
开发者ID:gitter-badger,项目名称:engauge6,代码行数:20,代码来源:ExportOrdinalsSmooth.cpp
注:本文中的Transformation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论