本文整理汇总了C++中cube函数的典型用法代码示例。如果您正苦于以下问题:C++ cube函数的具体用法?C++ cube怎么用?C++ cube使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cube函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cube
void MagicCube::rotateMagicCubeVerticalCW() {
MagicCube cube(*this);
this->setCubeFace(FRONT, cube.getCubeFace(TOP));
this->setCubeFace(LEFT, cube.getCubeFace(LEFT) + QUARTER);
this->setCubeFace(REAR, cube.getCubeFace(BUTTOM));
this->setCubeFace(RIGHT, cube.getCubeFace(RIGHT) - QUARTER);
this->setCubeFace(TOP, cube.getCubeFace(REAR));
this->setCubeFace(BUTTOM, cube.getCubeFace(FRONT));
this->cubeFace[FRONT] += HALF;
this->cubeFace[TOP] += HALF;
}
开发者ID:derek800109,项目名称:Rubik-s-Cude,代码行数:12,代码来源:MagicCube.cpp
示例2: main
int main(void)
{
printf("Enter an integer value: ");
scanf("%ld", &input);
answer = cube(input);
/* Note: %ld is the conversion specifier for long input */
printf("The cube of %ld is %ld\n", input, answer);
return 0;
}
开发者ID:carolynfischer,项目名称:c,代码行数:12,代码来源:function_cube.c
示例3: keep_block
static void keep_block(double width, double length, double height)
{
xlate(0, 0, height / 2.0);
diff();
cube(width, length, height, 1);
keep_block_windows(width, length, height);
rotate(90, 0, 0, 1);
keep_block_windows(length, width, height);
endrotate();
enddiff();
endxlate();
}
开发者ID:kennib,项目名称:openpyscad,代码行数:12,代码来源:castle.c
示例4: display
/* Fonction d'affichage du cube avec application de rotation */
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef (rotx, 1.0, 0.0, 0.0);
glRotatef (roty, 0.0, 1.0, 0.0);
cube ();
glPopMatrix();
glutSwapBuffers ();
}
开发者ID:ulricheza,项目名称:Isima,代码行数:13,代码来源:cube_rgb.c
示例5: cube
void Blob::_init(int n, int c, int h, int w, int type) {
if (type == TONES) {
data_ = vector<cube>(n, cube(h, w, c, fill::ones));
return;
}
if (type == TZEROS) {
data_ = vector<cube>(n, cube(h, w, c, fill::zeros));
return;
}
if (type == TDEFAULT) {
data_ = vector<cube>(n, cube(h, w, c));
return;
}
for (int i = 0; i < n; ++i) {
cube tmp;
if (type == TRANDU) tmp = randu<cube>(h, w, c);
if (type == TRANDN) tmp = randn<cube>(h, w, c);
data_.push_back(tmp);
}
return;
}
开发者ID:xenron,项目名称:sandbox-da-Caffe,代码行数:21,代码来源:blob.cpp
示例6: main
int main()
{
long int cube(long int n);
long int n;
while(scanf("%ld",&n)==1 && n!=0)
{
long int a;
int flag=0;
a=sqrt(n);
long int i=0,j, temp=1000,temp2=1000;
if(n==1)
printf("No solution\n");
else
{
for(j=a;j>0;j--)
{
for(i=1; i<a; i++)
{
if(n==cube(j)-cube(i))
{
if(j<temp && i<temp2)
{
temp=j;
temp2=i;
}
flag=1;
break;
}
}
}
if(flag==0)
printf("No solution\n");
else
printf("%ld %ld\n",temp,temp2);
}
}
return 0;
}
开发者ID:AhmadMusa,项目名称:codes,代码行数:40,代码来源:acm+cubes.c
示例7: IMP_USAGE_CHECK_VARIABLE
double ComplementarityRestraint::unprotected_evaluate_if_good(
DerivativeAccumulator *accum, double max) const {
IMP_OBJECT_LOG;
IMP_USAGE_CHECK_VARIABLE(accum);
IMP_USAGE_CHECK(!accum,
"ComplementarityRestraint does not support derivatives.");
double vol = cube(voxel_size_);
internal::ComplementarityParameters params;
params.maximum_separation = maximum_separation_;
params.maximum_penetration_score =
std::min(maximum_penetration_score_ / vol, max);
// std::cout<<"max penet score:"<<params.maximum_penetration_score<<"(" <<
// maximum_penetration_score_<<","<<vol<<","<<max<<")"<<std::endl;
base::Pointer<GridObject> ga =
get_grid_object(rba_, a_, ok_, complementarity_thickness_,
complementarity_value_, interior_thickness_, voxel_size_);
base::Pointer<GridObject> gb =
get_grid_object(rbb_, b_, ok_, complementarity_thickness_,
complementarity_value_, interior_thickness_, voxel_size_);
algebra::Transformation3D tra =
ga->get_data().first *
rba_.get_reference_frame().get_transformation_from();
algebra::Transformation3D trb =
rbb_.get_reference_frame().get_transformation_to() / gb->get_data().first;
// transform a by tra and b by trb
// same as transforming b by na/oa Ma= oa/ nai nb/ob p
algebra::Transformation3D tr = tra * trb;
IMP_LOG_TERSE("Transformation is " << tr << " between "
<< rba_.get_reference_frame() << " and "
<< rbb_.get_reference_frame()
<< std::endl);
IMP::multifit::internal::FitScore ps =
IMP::multifit::internal::get_fit_scores(
ga->get_data().second, gb->get_data().second, tr, params);
IMP_LOG_TERSE("Scores are " << ps.penetration_score << ", "
<< ps.complementarity_score << " and "
<< ps.boundary_score << std::endl);
/* std::cout<<"Scores are " << ps.penetration_score << ", "
<< ps.complementarity_score << " and "
<< ps.boundary_score
<< std::endl;*/
if (!score_acceptable(ps)) {
// std::cout<<"scores are not acceptable"<<std::endl;
return std::numeric_limits<double>::max();
}
double score = penetration_coef_ * ps.penetration_score +
complementarity_coef_ * ps.complementarity_score +
boundary_coef_ * ps.boundary_score;
return score * vol;
}
开发者ID:newtonjoo,项目名称:imp,代码行数:52,代码来源:ComplementarityRestraint.cpp
示例8: cube
//generates vertices given the origin and the dimensions
void genshapeClass::drawBox(float* c, float w, float h, float d)
{
float vertices[8][3] = { { c[0] - w / 2, c[1] - h / 2, c[2] + d / 2 },
{ c[0] - w / 2, c[1] + h / 2, c[2] + d / 2 },
{ c[0] + w / 2, c[1] + h / 2, c[2] + d / 2 },
{ c[0] + w / 2, c[1] - h / 2, c[2] + d / 2 },
{ c[0] - w / 2, c[1] - h / 2, c[2] - d / 2 },
{ c[0] - w / 2, c[1] + h / 2, c[2] - d / 2 },
{ c[0] + w / 2, c[1] + h / 2, c[2] - d / 2 },
{ c[0] + w / 2, c[1] - h / 2, c[2] - d / 2 } };
cube(vertices);
}
开发者ID:thebigbluebox,项目名称:OpenGL-Particle-System,代码行数:14,代码来源:genshapeClass.cpp
示例9: latin_solver_place
/*
* Function called when we are certain that a particular square has
* a particular number in it. The y-coordinate passed in here is
* transformed.
*/
void latin_solver_place(struct latin_solver *solver, int x, int y, int n)
{
int i, o = solver->o;
assert(n <= o);
assert(cube(x,y,n));
/*
* Rule out all other numbers in this square.
*/
for (i = 1; i <= o; i++)
if (i != n)
cube(x,y,i) = FALSE;
/*
* Rule out this number in all other positions in the row.
*/
for (i = 0; i < o; i++)
if (i != y)
cube(x,i,n) = FALSE;
/*
* Rule out this number in all other positions in the column.
*/
for (i = 0; i < o; i++)
if (i != x)
cube(i,y,n) = FALSE;
/*
* Enter the number in the result grid.
*/
solver->grid[y*o+x] = n;
/*
* Cross out this number from the list of numbers left to place
* in its row, its column and its block.
*/
solver->row[y*o+n-1] = solver->col[x*o+n-1] = TRUE;
}
开发者ID:4nh51rk,项目名称:sgtpuzzles,代码行数:44,代码来源:latin.c
示例10: legs
void legs(int t, int m)
{
push();
// translate(0.19*m, 0, -0.015);
translate(778*m, 0, -61);
// rotateX(cos(t)*13°-2.5);
rotateX(((cos(t)*929)>>12)-228); // 929->1024 = -12 bytes !
// translate(0, -0.7, 0);
translate(0, -2867, 0);
push();
// scale(0.1, 0.25, 0.1);
scale(410, 1024, 410);
cube();
pop();
// float d = -min(0, cos(t+3.14157/2));
int d = -cos(t+6434);
if ( d < 0 )
d = 0;
// translate(0, d*0.15-0.52, d*0.015-0.06);
translate(0, ((d*512)>>12)-2130, ((d*61)>>12)-246);
// rotateX(10°);
rotateX(715);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, -0.3, 0.1);
translate(0, -1229, 410);
push();
// scale(0.1, 0.03, 0.2);
scale(410, 123, 819);
cube();
pop();
pop();
}
开发者ID:msklywenn,项目名称:bitbox,代码行数:39,代码来源:main.c
示例11: drawBox
/* drawBox - takes centre point, width, height and depth of a box,
* calculates its corner vertices, and draws it with the cube function
*/
void drawBox(float* c, float w, float h, float d) //function for drawing cube(taken from Avenue)
{
float vertices[8][3] = { {c[0]-w/2, (c[1]-h/2)-1, c[2]+d/2},
{c[0]-w/2, (c[1]+h/2)-1, c[2]+d/2},
{c[0]+w/2, (c[1]+h/2)-1, c[2]+d/2},
{c[0]+w/2, (c[1]-h/2)-1, c[2]+d/2},
{c[0]-w/2, (c[1]-h/2)-1, c[2]-d/2},
{c[0]-w/2, (c[1]+h/2)-1, c[2]-d/2},
{c[0]+w/2, (c[1]+h/2)-1, c[2]-d/2},
{c[0]+w/2, (c[1]-h/2)-1, c[2]-d/2} };
cube(vertices);
}
开发者ID:DraganErak,项目名称:CS3GC3-Assignment-2,代码行数:16,代码来源:CS3GC3A2.cpp
示例12: main
int main(void)
{
double dbl;
printf("Please enter a number of type double: ");
scanf("%lf", &dbl);
cube(dbl);
getchar();
getchar();
return 0;
}
开发者ID:GregKM,项目名称:cop1220,代码行数:13,代码来源:main.c
示例13: displayFunc
void displayFunc() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //limpa o buffer
glMatrixMode(GL_MODELVIEW); //define que a matrix é a de modelo
//desenhar os objetos aqui:
//[TODO] PINO
//[TODO] PISTA
//[TODO] BOLA
cube(); //desenha um cubo
glFlush(); //força o desenho das primitivas
//glutSwapBuffers();
}
开发者ID:FelipeCZ,项目名称:UNIFESP,代码行数:13,代码来源:main.cpp
示例14: buildings
static void buildings()
{
float white[] = {1,1,1,1};
float black[] = {0,0,0,1};
glMaterialfv(GL_FRONT_AND_BACK,GL_SHININESS,shinyvec);
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,white);
glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,black);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
glColor3f(1,1,1);
glBindTexture(GL_TEXTURE_2D,sky[1]);
cube(5,15,5);
glDisable(GL_TEXTURE_2D);
}
开发者ID:Radhika231,项目名称:Computer-Graphics,代码行数:14,代码来源:projectreview.c
示例15: setRotate
void GLWidget::Draw()
{
setRotate();
GLfloat length = 2.0;
int i,j,k;
glPushMatrix();
for( i = -1; i <= 1; i++)
for( j = -1; j <= 1; j++)
for( k = -1; k <= 1; k++)
{
glPushMatrix();
glTranslatef(length*i*1.05,length*j*1.05,length*k*1.05);
cube(length);
glPopMatrix();
}
glPopMatrix();
swapBuffers();
/////////////////////////////////
/*
glPushMatrix();
glBegin( GL_QUADS );
glColor3f( 0.0, 1.0, 0.0 );
glVertex3f( 1.0, 1.0, -1.0 );
glVertex3f( -1.0, 1.0, -1.0 );
glVertex3f( -1.0, 1.0, 1.0 );
glVertex3f( 1.0, 1.0, 1.0 );glColor3f( 1.0, 0.5, 0.0 );
glVertex3f( 1.0, -1.0, 1.0 );
glVertex3f( -1.0, -1.0, 1.0 );
glVertex3f( -1.0, -1.0, -1.0 );
glVertex3f( 1.0, -1.0, -1.0 );glColor3f( 1.0, 0.0, 0.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glVertex3f( -1.0, 1.0, 1.0 );
glVertex3f( -1.0, -1.0, 1.0 );
glVertex3f( 1.0, -1.0, 1.0 );glColor3f( 1.0, 1.0, 0.0 );
glVertex3f( 1.0, -1.0, -1.0 );
glVertex3f( -1.0, -1.0, -1.0 );
glVertex3f( -1.0, 1.0, -1.0 );
glVertex3f( 1.0, 1.0, -1.0 );glColor3f( 0.0, 0.0, 1.0 );
glVertex3f( -1.0, 1.0, 1.0 );
glVertex3f( -1.0, 1.0, -1.0 );
glVertex3f( -1.0, -1.0, -1.0 );
glVertex3f( -1.0, -1.0, 1.0 );glColor3f( 1.0, 0.0, 1.0 );
glVertex3f( 1.0, 1.0, -1.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glVertex3f( 1.0, -1.0, 1.0 );
glVertex3f( 1.0, -1.0, -1.0 );
glEnd();
glPopMatrix();
*/
}
开发者ID:tangming10000,项目名称:Tang,代码行数:50,代码来源:glwidget.cpp
示例16: mat2Blob
// convertion
void mat2Blob(mat& mA, shared_ptr<Blob>& out, int c, int h, int w) {
int n = mA.n_rows;
assert(mA.n_cols == c*h*w);
mA = mA.t();
if (out) {
out.reset();
}
out.reset(new Blob(n, c, h, w));
for (int i = 0; i < n; ++i) {
(*out)[i] = cube(mA.colptr(i), h, w, c);
}
return;
}
开发者ID:xenron,项目名称:sandbox-da-Caffe,代码行数:15,代码来源:blob.cpp
示例17: cube
bool IsoSurfacePolygonizer::putInitialCube() {
StackedCube cube(0,0,0, 0);
m_cornerMap.clear();
// set corners of initial cube:
for(int i = 0; i < ARRAYSIZE(cube.m_corners); i++) {
cube.m_corners[i] = getCorner(BIT(i,2), BIT(i,1), BIT(i,0));
}
if(cube.intersectSurface()) {
addToDoneSet(cube.m_key);
pushCube(cube);
return true;
}
return false;
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:14,代码来源:IsosurfacePolygonizer.cpp
示例18: directionPdf
float PinholeCamera::directionPdf(const PositionSample &/*point*/, const DirectionSample &direction) const
{
Vec3f localD = _invTransform.transformVector(direction.d);
if (localD.z() <= 0.0f)
return 0.0f;
localD *= _planeDist/localD.z();
float u = (localD.x() + 1.0f)*0.5f;
float v = (1.0f - localD.y()/_ratio)*0.5f;
if (u < 0.0f || v < 0.0f || u > 1.0f || v > 1.0f)
return 0.0f;
return _invPlaneArea/cube(localD.z()/localD.length());
}
开发者ID:yanko,项目名称:tungsten,代码行数:14,代码来源:PinholeCamera.cpp
示例19: arms
void arms(int t, int m)
{
push();
// translate(0.24f*m, 0.4f, 0);
translate(983*m, 1638, 0);
// rotateZ(30°*m);
rotateZ(2145*m);
// rotateX(cos(t)*20°+180°);
rotateX(((cos(t)*1430)>>12)+12868);
// translate(0, 0.3, 0);
translate(0, 1229, 0);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, 0.22, 0);
translate(0, 901, 0);
// rotateY(abs(cos(t))*16*m);
int act = cos(t)*1144;
if ( act < 0 )
act = -act;
rotateY((act>>12)*m);
// rotateX(100°);
rotateX(7149);
// rotateZ(165°*m);
rotateZ(11796*m);
// translate(0, 0.21, 0);
translate(0, 860, 0);
push();
// scale(0.09, 0.27, 0.09);
scale(369, 1106, 369);
cube();
pop();
pop();
}
开发者ID:msklywenn,项目名称:bitbox,代码行数:37,代码来源:main.c
示例20: display
void display()
{
int width=glutGet(GLUT_WINDOW_WIDTH);
int height=glutGet(GLUT_WINDOW_HEIGHT);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.8,1,0);
square(-9.5,-9.5,19);
glColor3f(0,1,0);
square(-7,-6,13);
glColor3f(1,0,0);
drawstring(-7,4,"DR.AMBEDKAR INSTITUTE OF TECHNOLOGY");
drawstring(-3,3,"Welcome");
cube();
glutSwapBuffers();
}
开发者ID:sant0sh,项目名称:Pandora,代码行数:15,代码来源:WelcomeScreen.cpp
注:本文中的cube函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论