本文整理汇总了C++中Coords函数的典型用法代码示例。如果您正苦于以下问题:C++ Coords函数的具体用法?C++ Coords怎么用?C++ Coords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Coords函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verbose_ses_print_curve_states
LOCAL void verbose_ses_print_curve_states(
CURVE *curve,
SESAME_TABLE_TYPE eos_type,
SESAME_EOS *seos)
{
BOND *bb;
(void) printf("EOS states on curve %llu\n",curve_number(curve));
verbose_ses_print_state("Left state",Coords(curve->start->posn),
left_start_state(curve),eos_type,seos);
verbose_ses_print_state("Right state",Coords(curve->start->posn),
right_start_state(curve),eos_type,seos);
for (bb = curve->first; bb != NULL; bb = bb->next)
{
verbose_ses_print_state("Left state",Coords(bb->end),
left_state_at_point_on_curve(bb->end,bb,
curve),
eos_type,seos);
verbose_ses_print_state("Right state",Coords(bb->end),
right_state_at_point_on_curve(bb->end,bb,
curve),
eos_type,seos);
}
(void) printf("End of EOS states on curve %llu\n",curve_number(curve));
} /*end verbose_ses_print_curve_states*/
示例2: EnforceFlowSpecifedStates1d
LOCAL void EnforceFlowSpecifedStates1d(
Front *fr)
{
INTERFACE *intfc;
HYPER_SURF *hs;
POINT **p;
Locstate sl, sr;
if ((fr==NULL) || (Fsr_list(fr)==NULL) || (fr->rect_grid->dim!=1))
return;
intfc = fr->interf;
for (p = intfc->points; p && *p; ++p)
{
hs = Hyper_surf(*p);
if (BothSidesActive(hs,fr) == NO)
{
slsr(*p,NULL,Hyper_surf(*p),&sl,&sr);
(void) RegionIsFlowSpecified(sl,NULL,Coords(*p),
negative_component(hs),NO_COMP,fr);
(void) RegionIsFlowSpecified(sr,NULL,Coords(*p),
positive_component(hs),NO_COMP,fr);
}
}
} /*end EnforceFlowSpecifedStates1d*/
示例3: while
// Notes: 8x8 is best for AGP cards
// 16x16 is best for PCI cards
bool Sum::makeStrategy(GLuint w, GLuint h, int numReduce ) {
sizes.push_back(Coords(w,h));
while( w > 16 || h > 16 ) {
unsigned int newW, newH;
// pick the larger dimension
if ( w >= h ) {
newW = getBestFold(w,2);
newH = getBestFold(h,2);
}
else {
newW = getBestFold(w,2);
newH = getBestFold(h,2);
}
//make sure dimensions were divisible at least by two
//assert( newW != w );
//assert( newH != h );
if( newW == w || newH == h ) break;
w = newW;
h = newH;
sizes.push_back(Coords(w,h));
if( numReduce != -1 && sizes.size() > numReduce ) break;
}
cerr<<"Strategy for is: "<<endl;
cerr<<"====="<<endl;
for( unsigned int i=0 ; i<sizes.size() ; i++ ) {
cerr<<sizes[i].x()<<"x"<<sizes[i].y()<<endl;
}
cerr<<"====="<<endl;
return true;
}
示例4: BasicShape
TetrominoZ::TetrominoZ(std::vector<std::shared_ptr<Block>> blocks)
: BasicShape(3,
{Coords(0, 0), Coords(0, 1), Coords(1, 1), Coords(1, 2)},
blocks)
{
//ctor
}
示例5: gview_plot_curve2d
LOCAL void gview_plot_curve2d(
FILE *fp,
CURVE *c,
float *color)
{
BOND *b;
b = c->first;
fprintf(fp,"{ \n");
fprintf(fp,"appearance{*linewidth 2}\n");
fprintf(fp,"VECT\n");
fprintf(fp,"%1d %1d %1d\n", 1, c->num_points, 1);
fprintf(fp,"%1d\n%1d\n", c->num_points,1);
while (b)
{
fprintf(fp,"%f %f %f \n", Coords(b->start)[0],
Coords(b->start)[1] , 1.0);
if (b == c->last)
break;
b = b->next;
}
fprintf(fp,"%f %f %f \t\n", Coords(b->end)[0],
Coords(b->end)[1] , 1.0);
fprintf(fp,"%f %f %f %f \t\n",color[0],color[1],color[2],color[3]);
fprintf(fp,"}\n");
}
示例6: f_sort_bond_tris
EXPORT boolean f_sort_bond_tris(
INTERFACE *intfc)
{
BOND *b;
CURVE **c;
Locstate s0, s1;
int i, N;
size_t sizest;
static Locstate stemp = NULL;
if (!i_sort_bond_tris(intfc))
return NO;
sizest = size_of_state(intfc);
if ((sizest == 0) || !interpolate_intfc_states(intfc))
return YES;
if (stemp == NULL)
scalar(&stemp,size_of_state(intfc));
for (c = intfc->curves; c && *c; ++c)
{
N = (int) size_of_pointers(Btris((*c)->first));
for (b = (*c)->first; b != (*c)->last; b = b->next)
{
for (i = 0; i < N; ++i)
{
s0 = left_end_btri_state(Btris(b)[i]);
s1 = left_start_btri_state(Btris(b->next)[i]);
if (s0 != s1)
{
bi_interpolate_intfc_states(intfc,0.5,0.5,
Coords(b->end),s0,
Coords(b->end),s1,
stemp);
left_start_btri_state(Btris(b->next)[i]) = s0;
ft_assign(s0,stemp,sizest);
}
s0 = right_end_btri_state(Btris(b)[i]);
s1 = right_start_btri_state(Btris(b->next)[i]);
if (s0 != s1)
{
bi_interpolate_intfc_states(intfc,0.5,0.5,
Coords(b->end),s0,
Coords(b->end),s1,
stemp);
right_start_btri_state(Btris(b->next)[i]) = s0;
ft_assign(s0,stemp,sizest);
}
}
}
}
return YES;
} /*end f_sort_bond_tris*/
示例7: out_of_bound
LOCAL boolean out_of_bound(
POINT *p,
double *L,
double *U,
int dim)
{
int i;
for (i = 0; i < dim; ++i)
if (Coords(p)[i] < L[i] || Coords(p)[i] > U[i])
return YES;
return NO;
} /* end out_of_bound */
示例8: pt_compr
LOCAL int pt_compr(
const void *pp1,
const void *pp2)
{
POINT **p1 = (POINT**)pp1;
POINT **p2 = (POINT**)pp2;
if (Coords(*p1)[0] < Coords(*p2)[0])
return -1;
if (Coords(*p1)[0] > Coords(*p2)[0])
return 1;
return 0;
} /*end pt_compr*/
示例9: check_double_cone_point
EXPORT void check_double_cone_point(
INTERFACE *intfc)
{
SURFACE **s;
TRI *tri,*ptris[30],**tris;
int i,j,num_ptris,num_tris;
POINT *p;
HYPER_SURF *hs;
HYPER_SURF_ELEMENT *hse;
bool ptri_in_tri_list;
(void) printf("Start checking double cone point\n");
next_point(intfc,NULL,NULL,NULL);
while (next_point(intfc,&p,&hse,&hs))
{
num_ptris = 0;
num_tris = set_tri_list_around_point(p,Tri_of_hse(hse),
&tris,intfc);
for (s = intfc->surfaces; s && *s; ++s)
{
for (tri = first_tri(*s); !at_end_of_tri_list(tri,*s);
tri = tri->next)
{
if (Point_of_tri(tri)[0] == p ||
Point_of_tri(tri)[1] == p ||
Point_of_tri(tri)[2] == p)
ptris[num_ptris++] = tri;
}
}
for (i = 0; i < num_ptris; ++i)
{
ptri_in_tri_list = NO;
tri = ptris[i];
for (j = 0; j < num_tris; ++j)
{
if (tri == tris[j])
{
ptri_in_tri_list = YES;
break;
}
}
if (!ptri_in_tri_list)
{
(void) printf("double cone point found:\n");
(void) printf("double cone point p(%d) = %f %f %f\n",p,
Coords(p)[0],Coords(p)[1],Coords(p)[2]);
}
}
}
(void) printf("End checking double cone point\n");
} /* end check_double_cone_point */
示例10: point_inside_c_curve
LOCAL boolean point_inside_c_curve(
POINT *p,
C_CURVE *cc)
{
C_BOND *cb;
double v1[MAXD],v2[MAXD],vn0[MAXD],vn[MAXD];
int i;
cb = cc->first;
for (i = 0; i < 3; ++i)
{
v1[i] = Coords(cb->start)[i] - Coords(cb->end)[i];
v2[i] = Coords(p)[i] - Coords(cb->end)[i];
}
Cross3d(v1,v2,vn0);
for (cb = cb->next; cb != NULL; cb = cb->next)
{
for (i = 0; i < 3; ++i)
{
v1[i] = Coords(cb->start)[i] - Coords(cb->end)[i];
v2[i] = Coords(p)[i] - Coords(cb->end)[i];
}
Cross3d(v1,v2,vn);
if (Dot3d(vn,vn0) < 0.0) return NO;
}
return YES;
} /* end point_inside_c_curve */
示例11: main
int main(int argc, char **argv)
{
string sourceFile("SourceData.json");
WtmSourceDataSet* wtmSourceDataSet = WtmJsonLoader::loadWtmSourceDataSet(sourceFile);
Network* network = NetworkCreator::create(wtmSourceDataSet);
string worldFile("world2.json");
World* world = createWorldFromJsonFile(worldFile, argc, argv);
WtmActor wtmActor(network);
world->addActor(wtmActor, Coords(6, 6), Directions::Top);
MovingActor movingActorA(Directions::Top);
world->addActor(movingActorA, Coords(8, 0), Directions::Right);
MovingActor movingActorB(Directions::Right);
world->addActor(movingActorB, Coords(9, 5), Directions::Right);
MovingActor movingActorC(Directions::Right);
world->addActor(movingActorC, Coords(3, 11), Directions::Right);
MovingActor movingActorD(Directions::Right);
world->addActor(movingActorD, Coords(2, 3), Directions::Right);
world->startWorldLoop();
///*----------------------------------------------------------------------------------*/
//string wtmNetworkFile("DestData.json");
//Network* network = WtmJsonLoader::loadNetwork(wtmNetworkFile);
//string worldFile("world2.json");
//World* world = createWorldFromJsonFile(worldFile, argc, argv);
//MovingActor movingActor(Directions::Top);
//world->addActor(movingActor, Coords(7, 7), Directions::Right);
//WtmActor wtmActor(network);
//world->addActor(wtmActor, Coords(6, 9), Directions::Top);
//world->startWorldLoop();
///*----------------------------------------------------------------------------------*/
//string destFile("DestData.json");
//WtmJsonLoader::saveNetwork(destFile, wtmActor.network);
return 0;
}
示例12: f_second_order_intfc_propagate3d
LOCAL void f_second_order_intfc_propagate3d(
Front *fr,
POINTER wave,
INTERFACE *old_intfc,
INTERFACE *new_intfc,
double dt)
{
INTERFACE *tmp_intfc;
HYPER_SURF *oldhs, *tmphs, *newhs;
HYPER_SURF_ELEMENT *oldhse, *tmphse, *newhse;
POINT *oldp, *tmpp, *newp;
int i;
double V[MAXD];
printf("Entering f_second_order_intfc_propagate3d()\n");
set_copy_intfc_states(NO);
tmp_intfc = pp_copy_interface(fr->interf);
(void) next_point(old_intfc,NULL,NULL,NULL);
(void) next_point(tmp_intfc,NULL,NULL,NULL);
while (next_point(old_intfc,&oldp,&oldhse,&oldhs) &&
next_point(tmp_intfc,&tmpp,&tmphse,&tmphs))
{
point_propagate(fr,wave,oldp,tmpp,oldhse,oldhs,dt,V);
}
(void) next_point(tmp_intfc,NULL,NULL,NULL);
(void) next_point(new_intfc,NULL,NULL,NULL);
while (next_point(tmp_intfc,&tmpp,&tmphse,&tmphs) &&
next_point(new_intfc,&newp,&newhse,&newhs))
{
point_propagate(fr,wave,tmpp,newp,tmphse,tmphs,dt,V);
}
(void) next_point(old_intfc,NULL,NULL,NULL);
(void) next_point(tmp_intfc,NULL,NULL,NULL);
(void) next_point(new_intfc,NULL,NULL,NULL);
while (next_point(old_intfc,&oldp,&oldhse,&oldhs) &&
next_point(tmp_intfc,&tmpp,&tmphse,&tmphs) &&
next_point(new_intfc,&newp,&newhse,&newhs))
{
for (i = 0; i < 3; ++i)
Coords(newp)[i] = Coords(oldp)[i] + 0.5*(oldp->vel[i] +
tmpp->vel[i])*dt;
}
delete_interface(tmp_intfc);
printf("Leaving f_second_order_intfc_propagate3d()\n");
} /* end f_second_order_intfc_propagate3d */
示例13: Rect
void QAutoGenDialog::slotParameterActivated(int index)
{
QString strText = index > -1 && index < m_comboRegionIDs->count() ? m_comboRegionIDs->text(index) : QString::null;
if (strText.isEmpty())
{
m_pMap->setEnabled(false);
m_pMap->SetSelectionRect(Rect());
}
else
{
std::map<QString, Rect>::iterator iterMapSelection = m_mapMapSelections.find(strText);
if (iterMapSelection == m_mapMapSelections.end())
iterMapSelection = m_mapMapSelections.insert(std::pair<QString, Rect>(strText, Rect())).first;
m_pMap->setEnabled(true);
switch (m_pMap->GetSelectionMode())
{
case QMapWidget::SelectionModeRect:
m_pMap->SetSelectionRect(iterMapSelection->second);
if (iterMapSelection->second.m_iLeft != iterMapSelection->second.m_iRight || iterMapSelection->second.m_iTop != iterMapSelection->second.m_iBottom)
m_pMap->recenter(Coords((iterMapSelection->second.m_iLeft + iterMapSelection->second.m_iRight) / 2, (iterMapSelection->second.m_iTop + iterMapSelection->second.m_iBottom) / 2));
m_labelRegionInfo->setText(QString("Bounding box area: %1 sq. km.").arg(iterMapSelection->second.GetArea() * KILOMETERSPERMILE * KILOMETERSPERMILE));
break;
default:
break;
}
}
}
示例14: Coords
bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
if (m_World->IsChunkValid(a_ChunkX, a_ChunkZ))
{
// Already loaded (can happen, since the queue is async)
return true;
}
cChunkCoords Coords(a_ChunkX, a_ChunkY, a_ChunkZ);
// First try the schema that is used for saving
if (m_SaveSchema->LoadChunk(Coords))
{
return true;
}
// If it didn't have the chunk, try all the other schemas:
for (cWSSchemaList::iterator itr = m_Schemas.begin(); itr != m_Schemas.end(); ++itr)
{
if (((*itr) != m_SaveSchema) && (*itr)->LoadChunk(Coords))
{
return true;
}
}
// Notify the chunk owner that the chunk failed to load (sets cChunk::m_HasLoadFailed to true):
m_World->ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ);
return false;
}
示例15: test_vortex_vel
static int test_vortex_vel(
POINTER params,
Front *front,
POINT *p,
HYPER_SURF_ELEMENT *hse,
HYPER_SURF *hs,
float *vel)
{
DOUBLE_VORTEX_PARAMS *dv_params = (DOUBLE_VORTEX_PARAMS*)params;
float *coords = Coords(p);
float d1,d2;
float s1,s2;
float *cen1 = dv_params->cen1;
float *cen2 = dv_params->cen2;
float dx1,dy1;
float dx2,dy2;
dx1 = coords[0] - cen1[0];
dy1 = coords[1] - cen1[1];
dx2 = coords[0] - cen2[0];
dy2 = coords[1] - cen2[1];
d1 = sqrt(sqr(dx1) + sqr(dy1));
d2 = sqrt(sqr(dx2) + sqr(dy2));
s1 = dv_params->i1/2.0/PI/d1;
s2 = dv_params->i2/2.0/PI/d2;
vel[0] = s1*dy1/d1 + s2*dy2/d2;
vel[1] = -s1*dx1/d1 - s2*dx2/d2;
} /* end test_vortex_vel */