本文整理汇总了C++中corner函数的典型用法代码示例。如果您正苦于以下问题:C++ corner函数的具体用法?C++ corner怎么用?C++ corner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了corner函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetExtent
bool GetExtent(const Transform &inTransform,Extent2DF &ioExtent, bool)
{
/*
printf("In extent %f,%f ... %f,%f\n",
ioExtent.mMinX, ioExtent.mMinY,
ioExtent.mMaxX, ioExtent.mMaxY );
*/
for(int i=0; i<mTileData.size(); i++)
{
TileData &data= mTileData[i];
for(int c=0; c<4; c++)
{
UserPoint corner(data.mPos);
if (c&1) corner.x += data.mRect.w;
if (c&2) corner.y += data.mRect.h;
ioExtent.Add( inTransform.mMatrix->Apply(corner.x,corner.y) );
}
}
/*
printf("Got extent %f,%f ... %f,%f\n",
ioExtent.mMinX, ioExtent.mMinY,
ioExtent.mMaxX, ioExtent.mMaxY );
*/
return true;
}
开发者ID:evaluation-alex,项目名称:nme,代码行数:26,代码来源:TileRenderer.cpp
示例17: corner
void AyronShipPart::animate(Frame *space)
{
STACKTRACE;
SpaceSprite *spr;
if (!hascrew())
spr = sprite_uncrewed;
else
spr = sprite;
// the aa_stretch_blit scales down too much (dunno why).
// use the usual stretch_blit instead ?
Vector2 P, S, W;
S = spr->size(sprite_index);
P = corner(pos, S );
W = S * space_zoom;
BITMAP *b;
b = spr->get_bitmap(sprite_index);
masked_stretch_blit(b, space->surface, 0, 0, b->w, b->h, iround(P.x), iround(P.y), iround(W.x), iround(W.y));
//aa_stretch_sprite(b, space->surface, iround(P.x), iround(P.y), iround(W.x), iround(W.y));
space->add_box(P.x, P.y, W.x, W.y);
}
开发者ID:Yurand,项目名称:tw-light,代码行数:26,代码来源:shpayrbs.cpp
示例18: corner
bool WorldCrop::isChunkCompletelyContained(const mc::ChunkPos& chunk) const {
mc::BlockPos corner(chunk.x * 16, chunk.z * 16, 0);
return isBlockContainedXZ(corner)
&& isBlockContainedXZ(corner + mc::BlockPos(15, 0, 0))
&& isBlockContainedXZ(corner + mc::BlockPos(0, 15, 0))
&& isBlockContainedXZ(corner + mc::BlockPos(15, 15, 0));
}
开发者ID:dtfinch,项目名称:mapcrafter,代码行数:7,代码来源:worldcrop.cpp
示例19: m_Position
Camera::Camera(const vec3& position, const vec3& rot, float fov) :
m_Position(position), m_Rotation(rot), m_Fov(fov)
{
auto x = -((float)FRAME_WIDTH / (float)FRAME_HEIGHT);
auto y = 1.f;
vec3 corner(x, y, 1);
vec3 center(0, 0, 1);
auto scaling = tan(radians(m_Fov * 0.5f)) / (corner - center).length();
x *= scaling;
y *= scaling;
m_RotationMatrix = CreateRotationMatrix(m_Rotation);
m_TopLeft = vec3(m_RotationMatrix * vec4(x, y, 1, 1));
m_TopRight = vec3(m_RotationMatrix * vec4(-x, y, 1, 1));
m_DownLeft = vec3(m_RotationMatrix * vec4(x, -y, 1, 1));
m_UpDir = vec3(m_RotationMatrix * vec4(0, 1, 0, 1));
m_RightDir = vec3(m_RotationMatrix * vec4(1, 0, 0, 1));
m_FrontDir = vec3(m_RotationMatrix * vec4(0, 0, 1, 1));
m_TopLeft += m_Position;
m_TopRight += m_Position;
m_DownLeft += m_Position;
}
开发者ID:AlexanderMladenov,项目名称:EmbreeRT,代码行数:27,代码来源:camera.cpp
示例20: onDrawContent
virtual void onDrawContent(SkCanvas* canvas) {
SkScalar intervals[8] = { .5f, .3f, .5f, .3f, .5f, .3f, .5f, .3f };
SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, 2, fPhase));
SkAutoTUnref<SkCornerPathEffect> corner(SkCornerPathEffect::Create(.25f));
SkAutoTUnref<SkComposePathEffect> compose(SkComposePathEffect::Create(dash, corner));
SkPaint outlinePaint;
outlinePaint.setAntiAlias(true); // dashed paint for bitmap
outlinePaint.setStyle(SkPaint::kStroke_Style);
outlinePaint.setPathEffect(compose);
canvas->scale(10.0f, 10.0f); // scales up
for (int i = 0; i < fNumBits; ++i) {
canvas->save();
for (size_t j = 0; j < SK_ARRAY_COUNT(gBitsToPath_fns); ++j) {
SkPath path;
gBitsToPath_fns[j](&path, (char*) &gBits[i], fW, fH, fRowBytes);
//draw skPath and outline
canvas->drawPath(path, fBmpPaint);
canvas->translate(1.5f * fW, 0); // translates past previous bitmap
canvas->drawPath(path, outlinePaint);
canvas->translate(1.5f * fW, 0); // translates past previous bitmap
}
canvas->restore();
canvas->translate(0, 1.5f * fH); //translate to next row
}
// for animated pathEffect
fPhase += .01f;
this->inval(NULL);
}
开发者ID:Adenilson,项目名称:skia,代码行数:33,代码来源:SamplePathUtils.cpp
注:本文中的corner函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论