本文整理汇总了C++中Cone类的典型用法代码示例。如果您正苦于以下问题:C++ Cone类的具体用法?C++ Cone怎么用?C++ Cone使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mesa_redonda
void mesa_redonda(float alt) {
float altura=alt;
//Extras
float expMesa=altura/13;
float altCone=altura*0.2, altCilin=altura-altCone;
int camadas=60,lad=60;
//figuras
Cone *con = new Cone(altCone*1.5,altCone,camadas,lad,camadas);
Cilindro *cilAlt = new Cilindro(altCone*1.5/2,altCilin,camadas,lad,camadas);
Cilindro *cilTampo = new Cilindro(altCone*2.5,expMesa,camadas,lad,camadas);
glPushMatrix();
con->desenhar();
glPopMatrix();
glPushMatrix();
glTranslatef(0,(altCone*0.5)+(altCilin/2),0);
cilAlt->desenhar();
glPopMatrix();
glPushMatrix();
glTranslatef(0,(altCone*0.5)+(altCilin)+(expMesa/2),0);
cilTampo->desenhar();
glPopMatrix();
}
示例2: GraphicsCallback
//
// The Graphics Callback runs in the application "client thread" (qhStart) and sets the transformations
// for the Red Sphere and Green Line of the Cursor. Also, this callback sets the WorldToDevice matrix
// for use in the ServoLoopCallback.
//
void GraphicsCallback(void)
{
QHGLUT* localDisplayObject = QHGLUT::searchWindow("Coulomb Field Demo");//Get a Pointer to the display object
Cursor* localDeviceCursor = Cursor::searchCursor("devCursor");//Get a pointer to the cursor
Cylinder* localForceArrow = Cylinder::searchCylinder("forceArrow");//get a pointer to the cylinder
Cone* localForceArrowTip = Cone::searchCone("forceArrowTip");//get a pointer to the cylinder
Sphere* localCursorSphere = Sphere::searchSphere("cursorSphere");//get a pointer top the Sphere
if( localDisplayObject == NULL || localDeviceCursor == NULL || localForceArrow == NULL || localCursorSphere == NULL)
return;
hduMatrix CylinderTransform;//Transformation for the Cylinder. This transform makes it point toward the Model
hduVector3Dd localCursorPosition;
hduVector3Dd DirectionVecX;
hduVector3Dd PointOnPlane;
hduVector3Dd DirectionVecY;
hduVector3Dd DirectionVecZ;
//Compute the world to device transform
WorldToDevice = localDisplayObject->getWorldToDeviceTransform();
// Set transform for Red Sphere
localCursorPosition = localDeviceCursor->getPosition();//Get the local cursor position in World Space
hduVector3Dd localCursorSpherePos = localCursorSphere->getTranslation();
localCursorSphere->setTranslation(-localCursorSpherePos);
localCursorSphere->setTranslation(localCursorPosition);//Set the position of the Sphere the same as the cursor
////////////////////////////////////////////////////////////////////////////////////////////
//Code to calculate the transform of the green cylinder to point along the force direction
////////////////////////////////////////////////////////////////////////////////////////////
hduMatrix DeviceToWorld = WorldToDevice.getInverse();
HDdouble ForceMagnitude = forceVec.magnitude();
DeviceToWorld[3][0] = 0.0;
DeviceToWorld[3][1] = 0.0;
DeviceToWorld[3][2] = 0.0;
DirectionVecX = forceVec * DeviceToWorld;
DirectionVecX.normalize();
PointOnPlane.set(0.0,0.0,(DirectionVecX[0]*localCursorPosition[0] + DirectionVecX[1]*localCursorPosition[1] + DirectionVecX[2]*localCursorPosition[2])/DirectionVecX[2]);
DirectionVecY = PointOnPlane - localCursorPosition;
DirectionVecY.normalize();
DirectionVecZ = -DirectionVecY.crossProduct(DirectionVecX);
CylinderTransform[0][0] = DirectionVecZ[0]; CylinderTransform[0][1] = DirectionVecZ[1]; CylinderTransform[0][2] = DirectionVecZ[2]; CylinderTransform[0][3] = 0.0;
CylinderTransform[1][0] = DirectionVecX[0]; CylinderTransform[1][1] = DirectionVecX[1]; CylinderTransform[1][2] = DirectionVecX[2]; CylinderTransform[1][3] = 0.0;
CylinderTransform[2][0] = DirectionVecY[0]; CylinderTransform[2][1] = DirectionVecY[1]; CylinderTransform[2][2] = DirectionVecY[2]; CylinderTransform[2][3] = 0.0;
CylinderTransform[3][0] = 0.0 ; CylinderTransform[3][1] = 0.0 ; CylinderTransform[3][2] = 0.0 ; CylinderTransform[3][3] = 1.0;
CylinderTransform = CylinderTransform * hduMatrix::createTranslation(localCursorPosition[0], localCursorPosition[1], localCursorPosition[2]);
localForceArrow->update(chargeRadius/4, ForceMagnitude*50, 15);
localForceArrow->setTranslation(localCursorPosition);
localForceArrow->setTransform(CylinderTransform);
hduMatrix ConeTransform = CylinderTransform * hduMatrix::createTranslation(DirectionVecX[0]
* ForceMagnitude*50,DirectionVecX[1] * ForceMagnitude*50,DirectionVecX[2] * ForceMagnitude*50 );
localForceArrowTip->setTransform(ConeTransform);
/////////////////////////////////////////////
}
示例3: setUprightRadius
void Microphone::setUprightRadius (float r) {
float shift = r - uR;
uR = r;
Cone upright (uH * 0.35211f, uR * 0.66667f, uR * 0.66667f, 24),
shroudLow(uH * 0.21127f, uR, uR, 24),
shroudHi (uH * 0.63317f, uR, uR, 24),
bridge (uH * 0.084537f,uR * 0.66667f, uR * 0.41667f, 24);
upright.Fly(bH);
shroudLow.Fly(tH * 0.0823f);
shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG);
bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight());
replaceMesh(MIC_UPRIGHT, upright);
replaceMesh(MIC_SHROUD_LOW, shroudLow);
replaceMesh(MIC_SHROUD_HI, shroudHi);
replaceMesh(MIC_BRIDGE, bridge);
for (int i = MIC_HANDLE_BU; i < MIC_HEAD; i++){
micParts[i]->Translate( micParts[i]->getPosition().x + shift,
micParts[i]->getPosition().y,
micParts[i]->getPosition().z);
recalcMeshVertices((MIC_PART)i, *micParts[i]);
}
}
示例4: glPushMatrix
void CadeiraVBO::banco_alto_parametros(float altura, float raio){
Cone* cc;
Cilindro* c1,*c2;
//Parte do centro
glPushMatrix();
glRotatef(180,1,0,0);
glTranslatef(0,-altura,0);
cc=new Cone(raio*0.22,altura,CAM,LAD,DR);
cc->desenhar();
glPopMatrix();
glPushMatrix();
glTranslatef(0,altura,0);
c1=new Cilindro(raio,altura*1/8,CAM,LAD,DR);
c1->desenhar();
glPopMatrix();
c2=new Cilindro(raio*0.4,altura*1/8,CAM,LAD,DR);
c2->desenhar();
}
示例5: main
int main()
{
//set up basisvectors
std::vector<std::vector<double> > basis(2,std::vector<double>(2));
basis[0][0] = 1;
basis[0][1] = 0;
basis[1][0] = 0;
basis[1][1] = 1;
//define lattice
Lattice myLattice(2,basis);
//set up cones
Cone Sigma0 = Cone({{1,0},{0,1}},myLattice);
Cone Sigma11 = Cone({{0,1},{-1,0}},myLattice);
Cone Sigma12 = Cone({{-1,0},{-1,-1}},myLattice);
Cone Sigma13 = Cone({{-1,-1},{-2,-3}},myLattice);
Cone Sigma21 = Cone({{-2,-3},{-1,-2}},myLattice);
Cone Sigma22 = Cone({{-1,-2},{0,-1}},myLattice);
Cone Sigma23 = Cone({{0,-1},{1,0}},myLattice);
//Define fan
std::vector<Cone> myCones = {Sigma0, Sigma11, Sigma12, Sigma13, Sigma21, Sigma22, Sigma23};
Fan myFan(myCones,myLattice);
//Get dual fan
Fan myDualFan = myFan.getCorrespondingDualFan();
std::vector<Cone> myDualCones = myDualFan.getCones();
std::cout << "CONES OF THE DUAL FAN" << std::endl;
std::cout << "----------------------" << std::endl;
for(int i = 0; i < myDualCones.size();++i)
{
std::cout << "Cone nr = " << i << std::endl;
Cone myDualCone = myDualCones[i];
std::vector<std::vector<double> > myBVs = myDualCone.getBasisVectors();
std::cout << " " << myBVs[0][0] << std::endl;
std::cout << "Ray 1 = " << myBVs[0][1] << std::endl;
std::cout << " " << myBVs[0][2] << std::endl;
std::cout << "" << std::endl;
std::cout << " " << myBVs[1][0] << std::endl;
std::cout << "Ray 2 = " << myBVs[1][1] << std::endl;
std::cout << " " << myBVs[1][2] << std::endl;
std::cout << "----------------------" << std::endl;
}
myFan.drawFan();
myDualFan.drawFan();
return 0;
}
示例6: matMulMat
void computeBV<OBB>(const Cone& s, OBB& bv)
{
Vec3f R[3];
matMulMat(s.getRotation(), s.getLocalRotation(), R);
Vec3f T = matMulVec(s.getRotation(), s.getLocalTranslation()) + s.getTranslation();
bv.To = T;
bv.axis[0] = Vec3f(R[0][0], R[1][0], R[2][0]);
bv.axis[1] = Vec3f(R[0][1], R[1][1], R[2][1]);
bv.axis[2] = Vec3f(R[0][2], R[1][2], R[2][2]);
bv.extent = Vec3f(s.radius, s.radius, s.lz / 2);
}
示例7: Fit
bool ConePrimitiveShape::Fit(const PointCloud &pc, float epsilon,
float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
MiscLib::Vector< size_t >::const_iterator end)
{
Cone fit = m_cone;
if(fit.LeastSquaresFit(pc, begin, end))
{
m_cone = fit;
return true;
}
return false;
}
示例8: switch
void Parser::parseCone(Scene* scene, TransformNode* transform, const Material& mat)
{
_tokenizer.Read( CONE );
_tokenizer.Read( LBRACE );
Cone* cone;
Material* newMat = 0;
double bottomRadius = 1.0;
double topRadius = 0.0;
double height = 1.0;
bool capped = true; // Capped by default
for( ;; )
{
const Token* t = _tokenizer.Peek();
switch( t->kind() )
{
case MATERIAL:
delete newMat;
newMat = parseMaterialExpression( scene, mat );
break;
case NAME:
parseIdentExpression();
break;
case CAPPED:
capped = parseBooleanExpression();
break;
case BOTTOM_RADIUS:
bottomRadius = parseScalarExpression();
break;
case TOP_RADIUS:
topRadius = parseScalarExpression();
break;
case HEIGHT:
height = parseScalarExpression();
break;
case RBRACE:
_tokenizer.Read( RBRACE );
cone = new Cone( scene, newMat ? newMat : new Material(mat),
height, bottomRadius, topRadius, capped );
cone->setTransform( transform );
scene->add( cone );
scene->addBB( cone );
return;
default:
throw SyntaxErrorException( "Expected: cone attributes", _tokenizer );
}
}
}
示例9: initAxisHandleObjects
void Handle::drawObjectTranslateAxisForDisplay()
{
if (!Handle::pObjectXTranslateHandleLine)
initAxisHandleObjects();
Cone* pXHead = Handle::pObjectXTranslateHandleHead;
Cone* pYHead = Handle::pObjectYTranslateHandleHead;
Cone* pZHead = Handle::pObjectZTranslateHandleHead;
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
EditHandle editHandle = ViewContext::instance().getEditHandle();
// if we've only got one, then the mouse must be down on one, so only draw that
if (editHandle >= eXTranslate && editHandle <= eZTranslate)
{
if (editHandle == eXTranslate)
{
glColor3f(1.0f, 0.0f, 0.0f);
OpenGLEx::drawLine(Point(0.0f, 0.0f, 0.0f), Point(1.0f, 0.0f, 0.0f));
pXHead->drawForDisplay();
}
else if (editHandle == eYTranslate)
{
glColor3f(0.0f, 1.0f, 0.0f);
OpenGLEx::drawLine(Point(0.0f, 0.0f, 0.0f), Point(0.0f, 1.0f, 0.0f));
pYHead->drawForDisplay();
}
else if (editHandle == eZTranslate)
{
glColor3f(0.0f, 0.0f, 1.0f);
OpenGLEx::drawLine(Point(0.0f, 0.0f, 0.0f), Point(0.0f, 0.0f, 1.0f));
pZHead->drawForDisplay();
}
}
else
{
// draw them all
glColor3f(1.0f, 0.0f, 0.0f);
OpenGLEx::drawLine(Point(0.0f, 0.0f, 0.0f), Point(1.0f, 0.0f, 0.0f));
pXHead->drawForDisplay();
glColor3f(0.0f, 1.0f, 0.0f);
OpenGLEx::drawLine(Point(0.0f, 0.0f, 0.0f), Point(0.0f, 1.0f, 0.0f));
pYHead->drawForDisplay();
glColor3f(0.0f, 0.0f, 1.0f);
OpenGLEx::drawLine(Point(0.0f, 0.0f, 0.0f), Point(0.0f, 0.0f, 1.0f));
pZHead->drawForDisplay();
}
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
}
示例10: ReadNextExactToken
Node<real>* SceneImporter<real>::ReadCone( std::istream& stream, const std::string& name )
{
Cone<real>* cone = new Cone<real>;
cone->SetName( name );
ReadGeometryHeader( stream, cone ); ReadNextExactToken( stream, "," );
real height = ReadReal( stream ); ReadNextExactToken( stream, "," );
real radius = ReadReal( stream ); ReadNextExactToken( stream, "," );
real radiusSubdivisions = ReadUnsignedInt( stream );
cone->SetSizes( height, radius, radiusSubdivisions );
return cone;
}
示例11: ConePrimitiveShape
PrimitiveShape *ConePrimitiveShape::LSFit(const PointCloud &pc, float epsilon,
float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
MiscLib::Vector< size_t >::const_iterator end,
std::pair< size_t, float > *score) const
{
Cone fit = m_cone;
if(fit.LeastSquaresFit(pc, begin, end))
{
score->first = -1;
return new ConePrimitiveShape(fit);
}
score->first = 0;
return NULL;
}
示例12: setUprightGap
void Microphone::setUprightGap (float g) {
float shift = g - uG;
Cone upright (uH * 0.21127f + 2 * g, uR * 0.66667f, uR * 0.66667f, 24),
shroudLow(uH * 0.21127f, uR, uR, 24),
shroudHi ( uH * 0.7042f - 2*uG - shift, uR, uR, 24);
upright.Fly(bH);
shroudLow.Fly(tH * 0.0823f);
shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + g);
replaceMesh(MIC_UPRIGHT, upright);
replaceMesh(MIC_SHROUD_LOW, shroudLow);
replaceMesh(MIC_SHROUD_HI, shroudHi);
}
示例13: setUprightHeight
void Microphone::setUprightHeight (float h) {
float shift = h - uH;
tH += shift; uH = tH * 0.58436f;
Cone upright (uH * 0.21127f + 2 * uG, uR * 0.66667f, uR * 0.66667f, 24),
shroudLow(uH * 0.21127f, uR, uR, 24),
shroudHi (uH - upright.getHeight() - uH * 0.084537f, uR, uR, 24),
bridge (uH * 0.084537f,uR * 0.66667f, uR * 0.41667f, 24);
Pyramid handleBridgeUp (uH * 0.09155f, uR * 0.653f, hI, uR * 0.653f, hI),
handleBridgeDown(uH * 0.077f, uR * 0.653f, hI, uR * 0.653f, hI),
handle (uH * 0.7598f, uR * 0.792f, uR * 0.5418f, uR * 0.5418f, uR * 0.5418f, uR * 0.125f),
handleTop (uH * 0.05647f, uR * 0.792f, uR * 0.5418f, uR * 0.792f, uR * 0.5418f,-uR * 0.3542f);
upright.Fly(bH);
shroudLow.Fly(tH * 0.0823f);
shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG);
bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight());
handleBridgeUp.Fly(tH * 0.46f);
handleBridgeUp.Follow(bR * 0.2f);
handleBridgeDown.Fly(tH * 0.15f);
handleBridgeDown.Follow(handleBridgeUp.getPosition().x);
handle.Translate(bR * 0.306f, bR * 0.0059f, tH * 0.547f);
handle.Pitch((FLOAT)M_PI);
handle.Yaw((FLOAT)M_PI_2);
handleTop.Translate(handle.getPosition().x, handle.getPosition().y, handle.getPosition().z);
handleTop.Yaw((FLOAT)M_PI_2);
replaceMesh(MIC_UPRIGHT, upright);
replaceMesh(MIC_SHROUD_LOW, shroudLow);
replaceMesh(MIC_SHROUD_HI, shroudHi);
replaceMesh(MIC_BRIDGE, bridge);
replaceMesh(MIC_HANDLE_BU, handleBridgeUp);
replaceMesh(MIC_HANDLE_BD, handleBridgeDown);
replaceMesh(MIC_HANDLE, handle);
replaceMesh(MIC_HANDLE_TOP, handleTop);
for (int i = MIC_HEAD; i < PARTS_NUM; i++){
micParts[i]->Translate( micParts[i]->getPosition().x,
micParts[i]->getPosition().y,
bridge.getPosition().z + bridge.getHeight() + hR);
recalcMeshVertices((MIC_PART)i, *micParts[i]);
}
}
示例14: sqrt
void Cross::pickCones(const RayCast& ray, int width, int height){
int distTol = 30;
float x = ray.currentX;
float y = ray.currentY;
float vX = 2.0 / (float) width;
int rayX = (x + 1.0f) / vX;
float vY = 2.0 / (float) height;
int rayY = (y + 1.0f) / vY;
float minDist = 9999.0f;
Cone* minBody = NULL;
for(unsigned int i = 0; i < cones.size(); i++){
Cone* body = cones[i];
const vec3& bodyProjectedPosition = body->getProjectedPosition();
float bodyX = bodyProjectedPosition.x;
float bodyY = bodyProjectedPosition.y;
int bodypX = (bodyX + 1.0f) / vX;
int bodypY = (bodyY + 1.0f) / vY;
int dx = rayX - bodypX;
int dy = rayY - bodypY;
int dist = sqrt(dx*dx + dy*dy);
if(dist < distTol){
if(dist < minDist){
minDist = dist;
minBody = body;
}
}
}
if(minBody != NULL){
this->pickedCone = minBody;
this->pickedCone->setColor(COLOR_OBJECT_ACTIVE);
return;
}
}
示例15: if
bool RayTracer::shadow_ray_intersection(SbVec3f *point_of_intersection, SbVec3f *ray_direction, int light_source){
float t_value;
for(int j=0; j< objects.size(); j++){
//Cube tempCube;
bool intersects = false;
int shapetype = 0;
shapetype = objects.at(j).shapeType ;
if(shapetype == 1){
Sphere tempSphere = objects.at(j);
if(tempSphere.transparency > 0 && refraction_on) continue;
intersects = tempSphere.intersection(point_of_intersection, ray_direction, &t_value);
//intersects = tempSphere.intersection(&poi, &ray_direction, &t_value);
}
else if (shapetype ==2){
//std::cout<<"cube";
Cube tempCube = objects.at(j);
if(tempCube.transparency > 0 && refraction_on) continue;
intersects = tempCube.intersection(point_of_intersection, ray_direction, &t_value);
//temp = (Cube)tempCube;
}else if (shapetype == 3){
Cone tempCone = objects.at(j);
if(tempCone.transparency > 0 && refraction_on) continue;
intersects = tempCone.intersection(point_of_intersection, ray_direction, &t_value);
}
else{
//std::cout<<"cube";
Cube tempCylinder = objects.at(j);
if(tempCylinder.transparency > 0 && refraction_on) continue;
intersects = tempCylinder.intersection(point_of_intersection, ray_direction, &t_value);
//intersects = tempCube.intersection(&poi, &ray_direction, &t_value);
//temp = (Cube)tempCube;
}
if(intersects)
return true;
}
return false;
}