当前位置: 首页>>代码示例>>C++>>正文


C++ Point2d::x方法代码示例

本文整理汇总了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()");
    }
}
开发者ID:mousebird,项目名称:WhirlyGlobe,代码行数:30,代码来源:QuadImageOfflineLayer_jni.cpp

示例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;
 }
开发者ID:ianmackenzie,项目名称:cpp-opensolid-core,代码行数:9,代码来源:Triangle.hpp

示例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;
}
开发者ID:mousebird,项目名称:WhirlyGlobe,代码行数:10,代码来源:WhirlyKitView.cpp

示例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);
}
开发者ID:skryvokhizhyn,项目名称:TransportMania,代码行数:15,代码来源:HeightMapLoaderConstant.cpp

示例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 );
  }
}
开发者ID:realisim,项目名称:realisim,代码行数:30,代码来源:MainDialog.cpp

示例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 );
  }
}
开发者ID:realisim,项目名称:realisim,代码行数:34,代码来源:MainDialog.cpp

示例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);
}
开发者ID:GaryFengzju,项目名称:OpenTspline,代码行数:7,代码来源:File.cpp

示例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;
}
开发者ID:skryvokhizhyn,项目名称:TransportMania,代码行数:31,代码来源:WindowRenderer.cpp

示例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;
    }


}
开发者ID:sharas666,项目名称:fensterchen,代码行数:9,代码来源:circle.cpp

示例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);
}
开发者ID:skryvokhizhyn,项目名称:TransportMania,代码行数:10,代码来源:ScreenSizeManipulator.cpp

示例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) ;
    }
开发者ID:NickDaniil,项目名称:structured,代码行数:15,代码来源:gim_rasterizer.cpp

示例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;
}
开发者ID:skryvokhizhyn,项目名称:TransportMania,代码行数:38,代码来源:HeightMapExtended.cpp

示例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);
	}
}
开发者ID:skryvokhizhyn,项目名称:TransportMania,代码行数:16,代码来源:TerrainRangeArc.cpp

示例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];
    }
  }
开发者ID:Barbakas,项目名称:LMA,代码行数:47,代码来源:adct.cpp

示例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()");
	}
}
开发者ID:mousebird,项目名称:WhirlyGlobe,代码行数:17,代码来源:Point2d_jni.cpp


注:本文中的Point2d::x方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。