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


C++ corner函数代码示例

本文整理汇总了C++中corner函数的典型用法代码示例。如果您正苦于以下问题:C++ corner函数的具体用法?C++ corner怎么用?C++ corner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了corner函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getCorner

/*
 * getCorner
 *
 * parameter which - int
 * return corner - float *
 */
float * BoundingBox::getCorner(int which) {
	float * point = new float[3];
	point[0]=data[corner(which,0)];
	point[1]=data[corner(which,1)];
	point[2]=data[corner(which,2)];
	return point;
} // end getCorner()
开发者ID:olearypatrick,项目名称:Domhan-Samhlaigh,代码行数:13,代码来源:BoundingBox.cpp

示例2: orthographic_projection_matrix

	namespace Numerics
	{
		UnitTest::Suite MatrixProjectionsTestSuite {
			"Euclid::Numerics::Matrix",

			{"Clip Space Orthographic Projection",
				[](UnitTest::Examiner & examiner) {
					// This is the natural clip space box:
					auto unit_box = Geometry::AlignedBox3::from_origin_and_size(Vec3{-1, -1, 0}, Vec3{2, 2, 1});
					
					auto projection = orthographic_projection_matrix(unit_box);
					
					examiner << "The unit projection should be the identity" << std::endl;
					examiner.expect(projection) == Mat44(IDENTITY);
				}
			},
			
			{"Unit Space Orthographic Projection",
				[](UnitTest::Examiner & examiner) {
					// This is the natural clip space box:
					auto unit_box = Geometry::AlignedBox3::from_center_and_size(ZERO, Vec3{2, 2, 2});
					
					auto projection = orthographic_projection_matrix(unit_box);
					
					examiner.expect(projection * unit_box.corner({false, false, false})) == Vec3{-1, -1, 0};
					examiner.expect(projection * unit_box.corner({true, true, true})) == Vec3{1, 1, 1};
				}
			},
		};
	}
开发者ID:kurocha,项目名称:euclid,代码行数:30,代码来源:Test.Projections.cpp

示例3: isCompletelyInsideNotInverted

bool peano::geometry::builtin::Tube::
isCompletelyInsideNotInverted( const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double> &resolution ) {
    tarch::la::Vector<DIMENSIONS,double> coords(0.0);
    tarch::la::Vector<DIMENSIONS,int> corner(0);
    bool isInside = true;

    // loop over the corners
    for (int i = 0; i < TWO_POWER_D; i++) {
        for (int d = 0; d < DIMENSIONS; d++) {
            coords(d) = (2*corner(d)-1)*resolution(d);
        }
        coords = coords + x;
        // let N be the point on the middle line of the tube, such that (x-N) is orthogonal to the middle line.
        // Then N = P1 + lambda*(P2-P1)
        double lambda = tarch::la::dot( (coords-_p1),_middleLine)/(tarch::la::dot(_middleLine,_middleLine));

        tarch::la::Vector<DIMENSIONS,double> N(_p1 + lambda*_middleLine);
        // compute distance from middle line
        double distance = tarch::la::dot(coords-N,coords-N);

        isInside = isInside && (!(distance > _radius*_radius))
                   && (!(lambda<0.0)) && (!(lambda>1.0));

        // go to next corner node
        peano::utils::dInc(corner,2);
    }

    return isInside;
}
开发者ID:p-hoffmann,项目名称:madpac,代码行数:29,代码来源:Tube.cpp

示例4: corner

void TeamIndicator::animate(Frame *space)
{
	STACKTRACE;
	if (!*indtoggle)
		return;

	if (mother->isInvisible())
		return;

	Vector2i co1, co2;

	co1 = corner(mother->pos - 0.5 * mother->size).round();
	co2 = corner(mother->pos + 0.5 * mother->size).round();

	if (co2.x < 0) return;
	if (co2.y < 0) return;
	if (co1.x >= space->surface->w) return;
	if (co1.y >= space->surface->h) return;

	int col;
								 // team 0 is black ...
	col = palette_color[mother->get_team() + 1];

	rect(space->surface, co1.x, co1.y, co2.x, co2.y, col);
	space->add_box(co1.x, co1.y, co2.x, co2.y);

}
开发者ID:Yurand,项目名称:tw-light,代码行数:27,代码来源:mmain.cpp

示例5: width

    void Ellipse::updateHandles()
    {
        Element::updateHandles();

        m_data->centerHandle.setPos(Point(corner().x() + width() / 2,
                                          corner().y() + height() / 2));
    }
开发者ID:ongbe,项目名称:xchart,代码行数:7,代码来源:graph_ellipse.cpp

示例6: corner

bool peano::geometry::builtin::CuttingPlane::isCompletelyOutside(
  const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double> &resolution ){
  bool isCompletelyOutside = true;
  bool isOnBoundary = true;

  tarch::la::Vector<DIMENSIONS,int> corner(0);
  tarch::la::Vector<DIMENSIONS,double> coords(0.0);

  //  a point is completely outside, if all corners of the surrounding rectangle/box of size 2*resolution are on the
  // "outer" side of the plane, i.e. the scalar product between normal and corner-_position-distance needs to be
  // bigger than zero for all corners!
  for (int i = 0; i < TWO_POWER_D; i++){
    for (int d = 0; d < DIMENSIONS; d++){
      coords(d) = (2*corner(d)-1)*resolution(d);
    }
    peano::utils::dInc(corner,2);
    coords = x+coords-_position;

    // if the dot-product is bigger/equal zero, the original point might be considered to be completely outside,
    // except for the case that...
    isCompletelyOutside = isCompletelyOutside && (!tarch::la::smaller(_normal*coords,0.0));
    // ... the meshsize is 0.0: we need to check if all points are located on the boundary (which is actually only the
    // current point). If so, this point cannot be completely outside.
    isOnBoundary = isOnBoundary && (tarch::la::equals(_normal*coords,0.0));
  }

  return isCompletelyOutside && (!isOnBoundary);
}
开发者ID:p-hoffmann,项目名称:madpac,代码行数:28,代码来源:CuttingPlane.cpp

示例7: getCenter

/*
 * getCenter
 *
 * return - float *
 */
float * BoundingBox::getCenter(void) {
	float * point = new float[3];
	point[0]=data[corner(0,0)] + (data[corner(7,0)] - data[corner(0,0)]) * 0.5f;
	point[1]=data[corner(0,1)] + (data[corner(7,1)] - data[corner(0,1)]) * 0.5f;
	point[2]=data[corner(0,2)] + (data[corner(7,2)] - data[corner(0,2)]) * 0.5f;
	return point;
} // end getCenter()
开发者ID:olearypatrick,项目名称:Domhan-Samhlaigh,代码行数:12,代码来源:BoundingBox.cpp

示例8: corner

double MxBlockModel::compute_corner_angle(MxFaceID f, unsigned long i)
{
    unsigned long i_prev = (i==0)?2:i-1;
    unsigned long i_next = (i==2)?0:i+1;

    Vec3 e_prev = corner(f, i_prev) - corner(f, i);
    e_prev.Normalize();
    Vec3 e_next = corner(f, i_next) - corner(f, i);
    e_next.Normalize();

    return acos(e_prev * e_next);
}
开发者ID:GarysRefererence2014,项目名称:k3d,代码行数:12,代码来源:MxBlockModel.cpp

示例9: Segment3f

 inline Segment3f operator*(Segment3f const& segment, Matrix43f const& matrix) {
     Segment3f transformedSegment = Segment3f::NOTHING;
     for (int i = 0; i < 8; ++i) {
         transformedSegment |= Segment3f(corner(segment, i) * matrix);
     }
     return transformedSegment;
 }
开发者ID:yuri-kilochek,项目名称:photon_mapping,代码行数:7,代码来源:Segment.hpp

示例10: drawing_mode

void BasiliskAreaHurt::animate(Frame *space)
{
	STACKTRACE;
	if (state == 0)
		return;
	int i, j;
	double t = 1 - life_counter/(double)lifetime;
	double  x0, y0, dx, dy;
	int xi, yi;
	Vector2 p0;
	drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
	for (i=0; i<num; i++) {
		p0 = corner(xp[i]);
		x0 = p0.x;
		y0 = p0.y;
		p0 = unit_vector(xv[i]) * 3 * space_zoom;
		dx = p0.x;
		dy = p0.y;
		for (j=3; j>=0; j--) {
			if (space_zoom <= 1)
				set_trans_blender(0, 0, 0, iround(space_zoom * 255 * t * (4-j) / 4.0));
			else
				set_trans_blender(0, 0, 0, iround(1 * 255 * t * (4-j) / 4.0));
			xi = iround(x0 - dx * j);
			yi = iround(y0 - dy * j);
			putpixel(space->surface, xi, yi, color);
			space->add_pixel(xi, yi);
		}
	}
	drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
}
开发者ID:Yurand,项目名称:tw-light,代码行数:31,代码来源:shpastba.cpp

示例11: corner

QRegion BusyDialog::roundedRect(const QRect &rect, int round)
{
    QRegion region;

    // middle and borders
    region += rect.adjusted(round, 0, -round, 0);
    region += rect.adjusted(0, round, 0, -round);

    // top left
    QRect corner(rect.topLeft(), QSize(round*2, round*2));
    region += QRegion(corner, QRegion::Ellipse);

    // top right
    corner.moveTopRight(rect.topRight());
    region += QRegion(corner, QRegion::Ellipse);

    // bottom left
    corner.moveBottomLeft(rect.bottomLeft());
    region += QRegion(corner, QRegion::Ellipse);

    // bottom right
    corner.moveBottomRight(rect.bottomRight());
    region += QRegion(corner, QRegion::Ellipse);

    return region;
}
开发者ID:abramhindle,项目名称:JamTaba,代码行数:26,代码来源:BusyDialog.cpp

示例12: corner

void RainbowRift::animate( Frame *frame )
{
	STACKTRACE;
	if (spawn_counter > 0) return;
	Vector2 s;
	s = corner(pos, Vector2(300,300));
	if ((s.x < -500) || (s.x > space_view_size.x + 500) ||
		(s.y < -500) || (s.y > space_view_size.y + 500))
		return;
	int b[n*6+2];
	int i;
	for (i = 0; i < n*6+2; i += 2) {
		b[i] = iround(s.x + p[i] * space_zoom);
		b[i+1] = iround(s.y + p[i+1] * space_zoom);
	}
	for (i = 0; i < n; i += 1) {
		RGB tc = c[n-i-1];
		int a = tw_color(tc.r, tc.g, tc.b);
		spline ( frame->surface, &b[i*6], a );
	}
	frame->add_box (
		iround(s.x - 2), iround(s.y -2),
		iround(300 * space_zoom+5), iround(300 * space_zoom+5)
		);
	return;
}
开发者ID:argarak,项目名称:tw-light,代码行数:26,代码来源:ggob.cpp

示例13: corner

void ossimTiledElevationDatabase::getBoundingRect(
   ossimRefPtr<ossimImageGeometry> geom, ossimGrect& boundingRect) const
{
   if ( geom.valid() )
   {
      std::vector<ossimGpt> corner(4);
      if ( geom->getCornerGpts(corner[0], corner[1], corner[2], corner[3]) )
      {
         ossimGpt ulGpt(corner[0]);
         ossimGpt lrGpt(corner[0]);
         for ( ossim_uint32 i = 1; i < 4; ++i )
         {
            if ( corner[i].lon < ulGpt.lon ) ulGpt.lon = corner[i].lon;
            if ( corner[i].lat > ulGpt.lat ) ulGpt.lat = corner[i].lat;
            if ( corner[i].lon > lrGpt.lon ) lrGpt.lon = corner[i].lon;
            if ( corner[i].lat < lrGpt.lat ) lrGpt.lat = corner[i].lat;
         }
         boundingRect = ossimGrect(ulGpt, lrGpt);
      }
      else
      {
         boundingRect.makeNan();
      }
   }
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:25,代码来源:ossimTiledElevationDatabase.cpp

示例14: corner

void LLToolBrushLand::determineAffectedRegions(region_list_t& regions,
											   const LLVector3d& spot ) const
{
	LLVector3d corner(spot);
	corner.mdV[VX] -= (mBrushSize / 2);
	corner.mdV[VY] -= (mBrushSize / 2);
	LLViewerRegion* region = NULL;
	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
	if(region && regions.find(region) == regions.end())
	{
		regions.insert(region);
	}
	corner.mdV[VY] += mBrushSize;
	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
	if(region && regions.find(region) == regions.end())
	{
		regions.insert(region);
	}
	corner.mdV[VX] += mBrushSize;
	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
	if(region && regions.find(region) == regions.end())
	{
		regions.insert(region);
	}
	corner.mdV[VY] -= mBrushSize;
	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
	if(region && regions.find(region) == regions.end())
	{
		regions.insert(region);
	}
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:31,代码来源:lltoolbrush.cpp

示例15: corner

// In this example, tool tips were set up to
// pop up when the user moves the mouse
// over this edit control.
// If the mouse is moved to the upper left-hand
// corner, the tool tip would disappear because of
// calling CancelToolTips.
void CMyEdit::OnMouseMove(UINT nFlags, CPoint point) 
{
   CRect corner(0, 0, 10, 10);
   if (corner.PtInRect(point))
      CancelToolTips();
   CEdit::OnMouseMove(nFlags, point);
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:13,代码来源:cwnd--canceltooltips_1.cpp


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