本文整理汇总了C++中Point2d::x方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2d::x方法的具体用法?C++ Point2d::x怎么用?C++ Point2d::x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2d
的用法示例。
在下文中一共展示了Point2d::x方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
JNIEXPORT void JNICALL Java_com_mousebird_maply_QuadImageOfflineLayer_geoBoundsForTileNative
(JNIEnv *env, jobject obj, jint x, jint y, jint level, jobject llObj, jobject urObj)
{
try
{
QuadImageOfflineLayerAdapter *adapter = QILAdapterClassInfo::getClassInfo()->getObject(env,obj);
Point2d *ll = Point2dClassInfo::getClassInfo()->getObject(env,llObj);
Point2d *ur = Point2dClassInfo::getClassInfo()->getObject(env,urObj);
if (!adapter || !ll || !ur)
return;
Mbr mbr = adapter->control->getQuadtree()->generateMbrForNode(WhirlyKit::Quadtree::Identifier(x,y,level));
GeoMbr geoMbr;
CoordSystem *wkCoordSys = adapter->control->getCoordSys();
geoMbr.addGeoCoord(wkCoordSys->localToGeographic(Point3f(mbr.ll().x(),mbr.ll().y(),0.0)));
geoMbr.addGeoCoord(wkCoordSys->localToGeographic(Point3f(mbr.ur().x(),mbr.ll().y(),0.0)));
geoMbr.addGeoCoord(wkCoordSys->localToGeographic(Point3f(mbr.ur().x(),mbr.ur().y(),0.0)));
geoMbr.addGeoCoord(wkCoordSys->localToGeographic(Point3f(mbr.ll().x(),mbr.ur().y(),0.0)));
ll->x() = geoMbr.ll().x();
ll->y() = geoMbr.ll().y();
ur->x() = geoMbr.ur().x();
ur->y() = geoMbr.ur().y();
}
catch (...)
{
__android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in QuadPagingLayer::geoBoundsForTileNative()");
}
}
示例2:
inline
double
crossProduct2d(const Point2d& p0, const Point2d& p1, const Point2d& p2) {
double a1 = p1.x() - p0.x();
double a2 = p1.y() - p0.y();
double b1 = p2.x() - p0.x();
double b2 = p2.y() - p0.y();
return a1 * b2 - a2 * b1;
}
示例3: calcFrustumWidth
void View::calcFrustumWidth(unsigned int frameWidth,unsigned int frameHeight,Point2d &ll,Point2d &ur,double & near,double &far)
{
ll.x() = -imagePlaneSize;
ur.x() = imagePlaneSize;
double ratio = ((double)frameHeight / (double)frameWidth);
ll.y() = -imagePlaneSize * ratio;
ur.y() = imagePlaneSize * ratio ;
near = nearPlane;
far = farPlane;
}
示例4: runtime_error
void
HeightMapLoaderConstant::Get(const Point2d & pos, const size_t sz, HeightMap & hm) const
{
if (pos.x() >= totalSize_ || pos.y() >= totalSize_)
{
throw std::runtime_error("Out of constant loader range");
}
const float value = sz == 1 ? pointValue_ : patchValue_;
const float increment = (pos.y() * totalSize_ + pos.x()) * increment_;
HeightMap::Container v(sz * sz, value + increment);
hm.Swap(v);
}
示例5: drawSceneForPicking
//------------------------------------------------------------------------------
void Viewer::drawSceneForPicking()
{
//dessine le dashboard
{
treeD::ScreenSpaceProjection ssp( Vector2d(width(), height()) );
Camera cam = getCamera();
glDisable( GL_LIGHTING );
for( int i = 0; i < mMainDialog.getNumberOfParticuleSystems(); ++i )
{
QColor c = idToColor( i );
glColor4ub( c.red(), c.green(), c.blue(), c.alpha() );
glPushMatrix();
Vector2i s = mSpriteCatalog.getSprite("crosshair").getFrameSize();
Point2d p = cam.worldToSreen( mMainDialog.getParticuleSystem(i).getPosition() );
glTranslated( p.x(), p.y(), 0.0);
glScaled( s.x(), s.y(), 0 );
drawRectangle( Point2d(-0.5), Vector2d(1.0) );
glPopMatrix();
}
// glPushMatrix();
// glTranslated( 10, 10, 0 );
// mSpriteCatalog.getSprite( "minus" ).draw();
// glPopMatrix();
glEnable( GL_LIGHTING );
}
}
示例6: draw
//------------------------------------------------------------------------------
void Viewer::draw()
{
for( int i = 0; i < mMainDialog.getNumberOfParticuleSystems(); ++i )
{ mMainDialog.getParticuleSystem(i).draw(); }
//dessine le dashboard
{
treeD::ScreenSpaceProjection ssp( Vector2d(width(), height()) );
Camera cam = getCamera();
glDisable( GL_LIGHTING );
glColor4ub( 255, 255, 255, 255 );
for( int i = 0; i < mMainDialog.getNumberOfParticuleSystems(); ++i )
{
if( mMainDialog.mSelectionId == i )
{ glColor4ub( 0, 255, 0, 255 ); }
glPushMatrix();
Point2d p = cam.worldToSreen( mMainDialog.getParticuleSystem(i).getPosition() );
glTranslated( p.x(), p.y(), 0.0);
mSpriteCatalog.getSprite( "crosshair" ).draw();
glPopMatrix();
}
glColor4ub( 255, 255, 255, 255 );
glPushMatrix();
glTranslated( 10, 10, 0 );
mSpriteCatalog.getSprite( "minus" ).draw();
glPopMatrix();
glEnable( GL_LIGHTING );
}
}
示例7: write_point
void File::write_point(const Point2d &p, FILE *pFile)
{
double x = p.x();
double y = p.y();
fwrite(&x, sizeof(double), 1, pFile);
fwrite(&y, sizeof(double), 1, pFile);
}
示例8:
ModelData
WindowRenderer::RenderRectangleWindow(const Size2d & size, const TextureId id)
{
using namespace boost::assign;
ModelData md;
md.textureId = id;
md.type = ModelData::Mode::Triangle;
md.points.reserve(4);
md.indexes.reserve(6);
md.textures.reserve(4);
const Point2d p = Point2d::Cast(size);
md.points +=
Point3d(0.0f, 0.0f, 0.0f),
Point3d(0.0f, p.y(), 0.0f),
Point3d(p.x(), p.y(), 0.0f),
Point3d(p.x(), 0.0f, 0.0f);
md.indexes += 0, 2, 1, 0, 3, 2;
md.textures +=
Point2d(0, 1),
Point2d(0, 0),
Point2d(1, 0),
Point2d(1, 1);
return md;
}
示例9: is_inside
bool Circle::is_inside(Point2d const& p) const { /*override*/
if(sqrt(pow(p.x()-m_mid_.x(),2)+pow(p.y()-m_mid_.y(),2))<=m_radius_) {
return true;
} else {
return false;
}
}
示例10:
Point2d
ScreenSizeManipulator::ConvertToOgl(const Point2d & p) const
{
assert(screenSize_ != Size2d());
const float x = (2 * p.x() - screenSize_.x()) / screenSize_.x();
const float y = (2 * p.y() - screenSize_.y()) / screenSize_.y();
return Point2d(x, y);
}
示例11: vertex
// Note: we do not use glColor because glColor is clamped to [0,1]
// and converted to an int !
void GimRasterizer::vertex(const Point2d& uv, const Point3d& xyz) {
float w = static_cast<float>(target_->width()) ;
// float s = (float(w) / (float(w) + 1.0)) ;
float s = ((float(w) - 0.99) / float(w)) ;
glTexCoord3d(xyz.x(), xyz.y(), xyz.z()) ;
// TODO: setup viewing matrix instead ...
float u = s * 2.0 * (uv.x() - 0.5) ;
float v = s * 2.0 * (uv.y() - 0.5) ;
glVertex2d(u,v) ;
}
示例12: range_error
HeightMap::Value
HeightMapExtended::At(const Point2d & p) const
{
if (p.x() >= extendedSz_ || p.y() >= extendedSz_)
{
const std::string err = (boost::format("Requested value out of range. Sz = %f x = %f y = %f") % extendedSz_ % p.x() % p.y()).str();
throw std::range_error(err);
}
if (extendedSz_ == GetSize())
{
return HeightMap::At(p);
}
const float factor = static_cast<float>(extendedSz_) / GetSize();
const float xScaled = p.x() / factor;
const float yScaled = p.y() / factor;
const float xUp = ::ceil(xScaled);
const float xDown = ::floor(xScaled);
const float yUp = ::ceil(yScaled);
const float yDown = ::floor(yScaled);
const Value v1U = HeightMap::At(Point2d(xUp, yDown));
const Value v2U = HeightMap::At(Point2d(xUp, yUp));
const Value v1 = Interpolate(v1U, v2U, yDown, yUp, yScaled);
const Value v1D = HeightMap::At(Point2d(xDown, yDown));
const Value v2D = HeightMap::At(Point2d(xDown, yUp));
const Value v2 = Interpolate(v1D, v2D, yDown, yUp, yScaled);
const Value v = Interpolate(v1, v2, xDown, xUp, xScaled);
return v;
}
示例13: GetIntersection
void
TerrainRangeArc::ProcessRange(const Point2d & vec, const Angle a, const int y, const AxisPairType & pt, const Point2d & c)
{
const IntersectionType & r = GetIntersection(vec, a, y, pt);
for (const AxisPairType & apt : r)
{
const TerrainRange::Range range(
utils::FloatFloorToInt(y + c.y()),
utils::FloatFloorToInt(apt.first + c.x()),
utils::FloatCeilToInt(apt.second + c.x())
);
PutRange(range);
}
}
示例14: T
void analytical_derivative2(const Camera& camera_, const Point3d& point_, const Point2d& obs, TooN::Matrix<2,12,double>& j)
{
typedef T Scalar;
const std::array<T,9> c = {
T(camera_[0],0),T(camera_[1],1),T(camera_[2],2),
T(camera_[3],3),T(camera_[4],4),T(camera_[5],5),
T(camera_[6],6),T(camera_[7],7),T(camera_[8],8)};
const std::array<T,3> pt = {T(point_[0],9),T(point_[1],10),T(point_[2],11)};
std::array<T,2> p;
const T theta2 = c[0]*c[0] + c[1]*c[1] + c[2]*c[2];
if (theta2 > Scalar(std::numeric_limits<double>::epsilon()))
{
const T
theta = sqrt(theta2),
costheta = cos(theta),
sintheta = sin(theta),
theta_inverse = 1.0 / theta,
w[3] = { c[0] * theta_inverse, c[1] * theta_inverse, c[2] * theta_inverse },
tmp = (w[0] * pt[0] + w[1] * pt[1] + w[2] * pt[2]) * (Scalar(1.0) - costheta),
p2 = pt[2] * costheta + (w[0] * pt[1] - w[1] * pt[0]) * sintheta + w[2] * tmp + c[5];
p[0] = - (pt[0] * costheta + (w[1] * pt[2] - w[2] * pt[1]) * sintheta + w[0] * tmp + c[3]) / p2;
p[1] = - (pt[1] * costheta + (w[2] * pt[0] - w[0] * pt[2]) * sintheta + w[1] * tmp + c[4]) / p2;
}
else
{
const T p2 = pt[2] + c[0] * pt[1] - c[1] * pt[0] + c[5];
p[0] = - (pt[0] + c[1] * pt[2] - c[2] * pt[1] + c[3]) / p2;
p[1] = - (pt[1] + c[2] * pt[0] - c[0] * pt[2] + c[4]) / p2;
}
const T
r2 = p[0]*p[0] + p[1]*p[1],
fx = c[6] * (Scalar(1.0) + r2 * (c[7] + c[8] * r2));
const typename T::Array
jacobx = (fx * p[0] - Scalar(obs.x())).infinite(),
jacoby = (fx * p[1] - Scalar(obs.y())).infinite();
for(int i = 0 ; i < 12 ; ++i)
{
j(0,i) = jacobx[i];
j(1,i) = jacoby[i];
}
}
示例15:
JNIEXPORT void JNICALL Java_com_mousebird_maply_Point2d_setValue
(JNIEnv *env, jobject obj, jdouble x, jdouble y)
{
try
{
Point2dClassInfo *classInfo = Point2dClassInfo::getClassInfo();
Point2d *pt = classInfo->getObject(env,obj);
if (!pt)
return;
pt->x() = x;
pt->y() = y;
}
catch (...)
{
__android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in Point2d::setValue()");
}
}