本文整理汇总了C++中coord函数的典型用法代码示例。如果您正苦于以下问题:C++ coord函数的具体用法?C++ coord怎么用?C++ coord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了coord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_room2
static int add_room2(t_lem_env *env, char *s, int i)
{
char *t;
char *tmp;
if ((t = ft_strstr(env->str, ft_strjoin(ft_strsub(s, 0, i), "\n")))
!= NULL)
{
if (t != env->str && *(--t) == '\n')
return (ft_error(env, 1));
}
tmp = ft_strjoin(env->str, ft_strsub(s, 0, i));
tmp = ft_strjoin(tmp, "\n");
free(env->str);
env->str = tmp;
env->nbroom += 1;
coord(s, i, env);
return (1);
}
示例2: coord
/*private*/
void
OffsetCurveSetBuilder::addLineString(const LineString *line)
{
if (distance <= 0.0 && ! curveBuilder.getBufferParameters().isSingleSided())
{
return;
}
#if GEOS_DEBUG
std::cerr<<__FUNCTION__<<": "<<line->toString()<<std::endl;
#endif
std::auto_ptr<CoordinateSequence> coord(CoordinateSequence::removeRepeatedPoints(line->getCoordinatesRO()));
#if GEOS_DEBUG
std::cerr<<" After coordinate removal: "<<coord->toString()<<std::endl;
#endif
std::vector<CoordinateSequence*> lineList;
curveBuilder.getLineCurve(coord.get(), distance, lineList);
addCurves(lineList, Location::EXTERIOR, Location::INTERIOR);
}
示例3: dvector
void Tet::dump_mesh(FILE *name){
Coord X;
X.x = dvector(0,QGmax*QGmax*QGmax-1);
X.y = dvector(0,QGmax*QGmax*QGmax-1);
X.z = dvector(0,QGmax*QGmax*QGmax-1);
coord(&X);
if(!option("NOHEADER"))
fprintf(name,"VARIABLES = x y z u\n");
fprintf(name,"ZONE T=\"Element %d\", I=%d, J=%d, K=%d,F=POINT\n",
0,qa,qb,qc);
for(int i=0;i<qtot;++i)
fprintf(name,"%lf %lf %lf %lf\n", X.x[i], X.y[i], X.z[i], h_3d[0][0][i]);
free(X.x);
free(X.y);
free(X.z);
}
示例4: coord
void ompl::geometric::ProjEST::addMotion(Motion *motion)
{
Grid<MotionInfo>::Coord coord(projectionEvaluator_->getDimension());
projectionEvaluator_->computeCoordinates(motion->state, coord);
GridCell *cell = tree_.grid.getCell(coord);
if (cell != nullptr)
{
cell->data.push_back(motion);
pdf_.update(cell->data.elem_, 1.0 / cell->data.size());
}
else
{
cell = tree_.grid.createCell(coord);
cell->data.push_back(motion);
tree_.grid.add(cell);
cell->data.elem_ = pdf_.add(cell, 1.0);
}
tree_.size++;
}
示例5: IloNumArray
DataNumMatrix& DataNumMatrix::operator=(const DataNumMatrix copy_Matrix){
this->n = copy_Matrix.n;
this->m = copy_Matrix.m;
this->env = copy_Matrix.env;
this->Matrix = IloArray<IloNumArray> (this->env,this->n);
for(int i = 0; i < this->n; i++){
this->Matrix[i] = IloNumArray(this->env,this->m);
}
for(int i = 1; i <= this->n; i++){
for(int j = 1; j <= this->m; j++){
Coordinate coord(i,j);
this->Matrix[i-1][j-1]= copy_Matrix.get(coord);
}
}
return *this;
}
示例6: metptomet
// prime MCOORD -> MCOORD
void metptomet(int ii, int jj, FTYPE*ucon)
{
int j,k;
FTYPE r, th, X[NDIM];
FTYPE dxdxp[NDIM][NDIM];
FTYPE tmp[NDIM];
coord(ii, jj, CENT, X);
bl_coord(X, &r, &th);
dxdxprim(X, r, th, dxdxp);
/* transform ucon */
// this is u^j = T^j_k u^k, as in above
DLOOPA tmp[j] = 0.;
DLOOP tmp[j] += dxdxp[j][k] * ucon[k];
DLOOPA ucon[j] = tmp[j];
/* done! */
}
示例7: prob
LinearProblem prob(const Mesh& mesh) const
{
CellFilter left = domain().left();
Expr u = new UnknownFunction(basis_, "u");
Expr v = new TestFunction(basis_, "v");
Expr dx = gradient(1);
Expr x = coord(0);
QuadratureFamily quad = new GaussianQuadrature(2*basis_.order());
const double pi = 4.0*atan(1.0);
Expr eqn = Integral(interior(), (dx*v)*(dx*u), quad)
+ Integral(interior(), -2.25*pi*pi*sin(3.0*pi*x/2.0)*v, quad);
Expr bc = EssentialBC(left, v*u, quad);
return LinearProblem(mesh, eqn, bc, v, u, vecType());
}
示例8: coord
sf::Vector2i GameMap::getTileCoord(Tile* tile)
{
sf::Vector2i coord(-1,-1);
for (int a(0); a < mapSize.x; a++)
{
for (int b(0); b < mapSize.y; b++)
{
Tile* temp = getTileByXY(sf::Vector2i(a, b));
if ( temp == tile)
{
coord.x = a;
coord.y = b;
return coord;
}
}
}
return coord;
}
示例9: coord
/**
* Convert the mouse cursor coordinate on the window (i.e. from (0,0) to (windowWidth, windowHeight))
* into normalised screen coordinate , i.e. (-1, -1) to (1, 1)
*/
glm::vec3 Arcball::toScreenCoord(double x, double y)
{
glm::vec3 coord(0.0f);
coord.x = (2.f * float(x) - m_windowWidth) / m_windowWidth;
coord.y = -(2.f * float(y) - m_windowHeight) / m_windowHeight;
/* Clamp cursor to border of the windows, comment these lines to allow rotation when cursor is outside the window */
coord.x = glm::clamp(coord.x, -1.0f, 1.0f);
coord.y = glm::clamp(coord.y, -1.0f, 1.0f);
float length_squared = coord.x * coord.x + coord.y * coord.y;
if (length_squared < 1.0) {
coord.z = sqrt(1.f - length_squared);
} else {
coord = glm::normalize(coord);
}
return coord;
}
示例10: main
int main()
{
uint n, k;
scanf("%u %u", &n, &k);
heap<coord> h(k / 2 + 1);
h.push(coord(n, n));
uint64 last = +INF;
for (uint i = 0; i < k; i++) {
while (h.front().value() >= last) {
repopulate(h);
}
last = repopulate(h);
printf("%llu\n", last);
}
return 0;
}
示例11: coord
// Find the X and Y in hex coordinates of the hexagon next to this hexagon
// in the direction specified.
Coord Hexagon::neighborCoord(int dir) const
{
static int evenx[] = { 0, -1, -1, 0, 1, 1 };
static int eveny[] = { -1, -1, 0, 1, 0, -1 };
static int oddx[] = { 0, -1, -1, 0, 1, 1 };
static int oddy[] = { -1, 0, 1, 1, 1, 0 };
Coord coord(m_x, m_y);
if (xeven())
{
coord.m_x += evenx[dir];
coord.m_y += eveny[dir];
}
else
{
coord.m_x += oddx[dir];
coord.m_y += oddy[dir];
}
return coord;
}
示例12: coord
void KSegmentorBase::copyIntegralDuringPaste(int kFrom, int kTo)
{
std::vector <unsigned int> coord(3);
unsigned int element=0;
for (int i=0;i<=this->dimx-1; i++) {
for (int j=0; j<=this->dimy-1; j++) {
double val = this->U_Integral_image->GetScalarComponentAsDouble(i,j,kFrom,0);
this->U_Integral_image->SetScalarComponentFromDouble(i,j,kTo,0,val);
if(fabs(val)>0)
{
element=kTo*dimx*dimy +j*dimx+i;
this->AddPointToUpdateVector(element);
coord[0] = (i);
coord[1] = (j);
coord[2] = (kTo);
this->AddPointToCoordinatesVector(coord);
}
}
}
}
示例13: __
void shell::paint( paint_param_t& paintParam, RECT const& rect ) {
struct _{
static void __( frame_ptr const& f, frame_coord const& coord, bool const cf, paint_param_t& pp, RECT r ) {
HDC dc = pp.dcb.dc;
RECT rt;
int const rw = RECT_WIDTH( r );
int const rh = RECT_HEIGHT( r );
rt.left = r.left + coord.left.get_n() * rw / coord.left.get_d();
rt.top = r.top + coord.top.get_n() * rh / coord.top.get_d();
rt.right = rt.left + rw / coord.width;
rt.bottom = rt.top + rh / coord.height;
//
//
FrameRect( dc, &rt, ( cf )?( pp.borderActive ):( pp.borderInactive ) );
InflateRect( &rt, -1, -1 );
//
SetBkMode( dc, TRANSPARENT );
//
atom::shared_gdiobj<HRGN> rgn = CreateRectRgn( rt.left, rt.top, rt.right, rt.bottom );
SelectClipRgn( dc, rgn );
{
SelectObject( dc, pp.sysFont.font);
SetTextColor( dc, pp.sysFont.color );
atom::stringstream_t ss;
ss << _T( " #" ) << f->get_index();
DrawText( dc, ss.str().c_str(), -1, &rt, DT_RIGHT | DT_TOP | DT_SINGLELINE );
//
SelectObject( dc, pp.textFont.font );
SetTextColor( dc, pp.textFont.color );
f->paint( dc, rt, pp.textFont.height );
}
SelectClipRgn( dc, NULL );
}
};
frame_coord coord( 0, 1, 0, 1, 1, 1 );
if ( this->expandMode ) {
_::__( this->currentFrame, coord, true, paintParam, rect );
} else {
this->headArea->draw( boost::bind( &_::__, _1, _2, _3, boost::ref( paintParam ), rect ), coord, this->currentFrame );
}
}
示例14: appendpf_local2std
// append local profile to MNI space profile
void appendpf_local2std(string coordfile_std2local) {
ifstream coordstream(coordfile_std2local);
floatVector coord(3);
vector<floatVector> coord_map_std2local;
for (int i=0; i<3; i++)
coordstream >> coord[i];
while(coordstream.good()) {
coord_map_std2local.push_back(coord);
for (int i=0; i<3; i++)
coordstream >> coord[i];
}
assert(coord_map_std2local.size()==conn_profile().size());
floatVector append;
intVector start(3);
floatVector coef(3);
intVector tmpCoord(3);
int dim_profile = (conn_profile().begin()->second).size();
auto it = conn_profile().begin();
for (int i=0; i<conn_profile().size(); i++, it++) {
for (int k=0; k<3; k++) {
start[k]=(int)coord_map_std2local[i][k];
coef[k] = coord_map_std2local[i][k]-start[k];
}
for (int z=0; z<2; z++) { // Note: we assume that all points are within the interiors, therefore exactly 8 neighbors
float fracZ = (1-coef[2])*(1-z)+coef[2]*z;
for (int y=0; y<2; y++) {
float fracZY=fracZ * ( (1-coef[1])*(1-y)+coef[1]*y );
for (int x=0; x<2; x++) {
float fracZYX=fracZY * ( (1-coef[0])*(1-x)+coef[0]*x );
tmpCoord[0]=start[0]+x; tmpCoord[1]=start[1]+y; tmpCoord[2]=start[2]+z;
if (conn_profile_local().count(tmpCoord)) {
for (int k=0; k<dim_profile; k++)
(it->second)[k] += fracZYX * conn_profile_local()[tmpCoord][k];
}
}
}
}
}
}
示例15: GUARD
/*
====================
Flush
====================
*/
VOID BrushLozenge::Flush(const Map* map, const Vector3& pt)
{
GUARD(BrushLozenge::Flush);
// compute the view
F32 radius = this->Radius();
Vector4 rect(pt[0]-P2U(TILE_WIDTH/2), pt[1], pt[0]+P2U(TILE_WIDTH/2), pt[1]+P2U(TILE_HEIGHT));
Rect src, dst, clip;
/*
src.left = U2P(rect[0])/U2P(CHUNK_STRIDE);
src.top = U2P(rect[1])/U2P(CHUNK_STRIDE);
src.right = (U2P(rect[2])%U2P(CHUNK_STRIDE)) ? (U2P(rect[2])/U2P(CHUNK_STRIDE)+1) : U2P(rect[2])/U2P(CHUNK_STRIDE);
src.bottom = (U2P(rect[3])%U2P(CHUNK_STRIDE)) ? (U2P(rect[3])/U2P(CHUNK_STRIDE)+1) : U2P(rect[3])/U2P(CHUNK_STRIDE);
*/
src.left = (U2P(rect[0])%U2P(CHUNK_STRIDE)) ? (U2P(rect[0])/U2P(CHUNK_STRIDE)-1) : U2P(rect[0])/U2P(CHUNK_STRIDE);
src.top = (U2P(rect[1])%U2P(CHUNK_STRIDE)) ? (U2P(rect[1])/U2P(CHUNK_STRIDE)-1) : U2P(rect[1])/U2P(CHUNK_STRIDE);
src.right = (U2P(rect[2])%U2P(CHUNK_STRIDE)) ? (U2P(rect[2])/U2P(CHUNK_STRIDE)+1) : U2P(rect[2])/U2P(CHUNK_STRIDE);
src.bottom = (U2P(rect[3])%U2P(CHUNK_STRIDE)) ? (U2P(rect[3])/U2P(CHUNK_STRIDE)+1) : U2P(rect[3])/U2P(CHUNK_STRIDE);
dst.left = -map->mWidth/2;
dst.top = 0;
dst.right = map->mWidth/2;
dst.bottom = map->mHeight;
IntersectRect(&clip, &dst, &src);
for(I32 j = clip.top; j < clip.bottom; j++)
{
for(I32 i = clip.left; i < clip.right; i++)
{
std::pair<I32,I32> coord(i,j);
std::map< std::pair<I32,I32>, ChunkPtr >::const_iterator it = map->mChunks.find(coord);
if(it == map->mChunks.end()) continue;
EChunkPtr chunk = dynamic_ptr_cast<EChunk>(it->second);
Matrix world = Matrix::makeTranslate(i*CHUNK_STRIDE,j*CHUNK_STRIDE,0);
Matrix world_inv; world_inv.invert(world);
Vector3 point = pt * world_inv;
this->Flush(chunk.Ptr(), point);
}
}
UNGUARD;
}