本文整理汇总了C++中drawAxis函数的典型用法代码示例。如果您正苦于以下问题:C++ drawAxis函数的具体用法?C++ drawAxis怎么用?C++ drawAxis使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawAxis函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: principalAxisGenList
GLuint principalAxisGenList(GLuint axisList)
{
V4d specular = {1.0f,1.0f,1.0f,1.0f};
V4d FirstDiffuse = {1.0f,1.0f,1.0f,1.0f};
V4d FirstAmbiant = {1.0f,1.0f,1.0f,1.0f};
V4d secondDiffuse = {1.0f,1.0f,1.0f,1.0f};
V4d secondAmbiant = {1.0f,1.0f,1.0f,1.0f};
V4d thirdDiffuse = {1.0f,1.0f,1.0f,1.0f};
V4d thirdAmbiant = {1.0f,1.0f,1.0f,1.0f};
V3d firstVector = {1.0f,1.0f,1.0f};
V3d secondVector = {1.0f,1.0f,1.0f};
V3d thirdVector = {1.0f,1.0f,1.0f};
GLdouble radius = axis.radius;
gint i;
if (glIsList(axisList) == GL_TRUE) glDeleteLists(axisList,1);
compute_the_principal_axis();
if(!axis.def) return 0;
for(i=0;i<3;i++)
{
FirstDiffuse[i] = axis.firstColor[i];
secondDiffuse[i] = axis.secondColor[i];
thirdDiffuse[i] = axis.thirdColor[i];
FirstAmbiant[i] = FirstDiffuse[i]/10;
secondAmbiant[i] = secondDiffuse[i]/10;
thirdAmbiant[i] = thirdDiffuse[i]/10;
}
FirstDiffuse[3] = 1;
FirstAmbiant[3] = 1;
secondDiffuse[3] = 1;
secondAmbiant[3] = 1;
thirdDiffuse[3] = 1;
thirdAmbiant[3] = 1;
for(i=0;i<3;i++)
{
firstVector[i] = axis.firstVector[i]*axis.scal;
secondVector[i] = axis.secondVector[i]*axis.scal;
thirdVector[i] = axis.thirdVector[i]*axis.scal;
}
axisList = glGenLists(1);
glNewList(axisList, GL_COMPILE);
drawAxis(firstVector, radius, axis.origin, specular, FirstDiffuse, FirstAmbiant);
drawAxis(secondVector, radius, axis.origin, specular, secondDiffuse, secondAmbiant);
drawAxis(thirdVector, radius, axis.origin, specular, thirdDiffuse, thirdAmbiant);
glEndList();
return axisList;
}
示例2: main
int main()
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "");
setbkcolor(WHITE);
Point p[4] =
{
Point{0,0},
Point{100,0},
Point{100,100},
Point{0,100}
};
int ch;
cleardevice();
drawAxis(BLACK);
for(int i = 0; i<4; i++)
{
Line l = {p[i], p[(i+1)%4]};
l.plotLineDDA(RED);
}
while((ch = getKeyCode())!=ESC)
{
switch(ch)
{
case 'A' :
for(int i = 0; i<4; i++)
{
rotateSingle(&p[i], toRadian(10));
}
break;
case 'W' :
for(int i = 0; i<4; i++)
{
translateSingle(&p[i], 10,10);
}
break;
case 'D' :
for(int i = 0; i<4; i++)
{
scaleSingle(&p[i], 1.5, 1.5);
}
break;
}
cleardevice();
drawAxis(BLACK);
for(int i = 0; i<4; i++)
{
Line l = {p[i], p[(i+1)%4]};
l.plotLineDDA(RED);
}
}
return 0;
}
示例3: ofSetColor
//--------------------------------------------------------------
void graph::draw(){
ofSetColor(255, 255, 255);
ofRect(graphX, graphY, graphW, graphH);
for ( int b=0; b<NUM_BEATS; b++ ) {
for ( int s=0; s<NUM_STEPS; s++ ) {
int num = (b * NUM_STEPS) + s;
// Draw Graph
int xDrawPoint = ((b * NUM_STEPS) + s) * (graphColPad + graphColW);
float val = sequencer->getSParam()->getStepValue(b, s) * graphH;
if (b == selectedBeat and s == selectedStep) {
// step selected
ofSetColor(204, 102, 0);
} else if (b == sequencer->getBeat() and s == sequencer->getStep()) {
// step playing
ofSetColor(255, 255, 255);
} else if (num >= highlightStart and num < highlightEnd) {
// step selected
ofSetColor(0, 204, 0);
} else {
ofSetColor(0, 102, 204);
}
ofRect(1 + xDrawPoint, graphH - val, graphColW, val);
// Draw Axis
string marker;
if (s == 0) {
marker = ofToString(b + 1);
drawAxis(marker, 15, xDrawPoint, graphH);
} else if (s == 8) {
marker = ofToString(b + 1) + ".2";
drawAxis(marker, 5, xDrawPoint, graphH);
} else if (s == 16) {
marker = ofToString(b + 1) + ".3";
drawAxis(marker, 5, xDrawPoint, graphH);
} else if (s == 24) {
marker = ofToString(b + 1) + ".4";
drawAxis(marker, 5, xDrawPoint, graphH);
}
// Draw highlightStart and highlightEnd
if (num == highlightStart || num == highlightEnd) {
ofSetColor(204, 102, 0);
ofRect(xDrawPoint, graphY, 1, graphH + 20);
}
}
}
}
示例4: drawWorldModelAbsolute
void drawWorldModelAbsolute(Canvas& canvas, const WorldModel2D& wm, const geo::Vec2& p0)
{
drawWorld(canvas, wm);
for(unsigned int i = 1; i < wm.entities.size(); ++i)
{
const Entity2D& e = wm.entities[i];
drawArrow(canvas, p0, e.pose.t, Color(150, 150, 150, 2));
drawAxis(canvas, e.pose);
}
drawAxis(canvas, fromXYA(p0.x, p0.y, 0));
}
示例5: getPlotArea
void LinePlot::drawPlot(Frame* frame)
{
Frame innerFrame = getPlotArea(frame);
// Obtain mins and maxes from the data
double minXdata, maxXdata, minYdata, maxYdata;
sl.findMinMax(minXdata,maxXdata,minYdata,maxYdata);
// Assume these will be used as boundaries of the plots
double minX=minXdata, maxX=maxXdata, minY=minYdata, maxY=maxYdata;
// See if the user overrode the axes limits
if (fixedXaxis)
{
minX = minx;
maxX = minx + width;
}
if (fixedYaxis)
{
minY = miny;
maxY = miny+height;
}
// Use default min/max
sl.drawInFrame(innerFrame,minX,maxX,minY,maxY);
setXAxis(minX, maxX);
setYAxis(minY, maxY);
drawAxis(frame);
}
示例6: glViewport
void OpenGLTransformation::drawSub1()
{
glViewport(0, 0, windowWidth / 2, windowHeight);
glScissor(0, 0, windowWidth / 2, windowHeight);
glClearColor(0.1f, 0.1f, 0.1f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
MatStack.matrixMode(tgt::MatrixStack::PROJECTION);
MatStack.pushMatrix();
MatStack.loadMatrix(camera->getProjectionMatrix(glm::ivec2(windowWidth * 0.5f, windowHeight)));
MatStack.matrixMode(tgt::MatrixStack::MODELVIEW);
MatStack.pushMatrix();
MatStack.loadMatrix(camera->getViewMatrix());
// always draw the grid at the origin (before any modeling transform)
drawGrid(10, 1);
drawAxis(4);
glm::mat4 cubeModel = glm::translate(glm::vec3(-0.5f));
MatStack.pushMatrix();
MatStack.loadMatrix(camera->getViewMatrix() * cubeModel);
drawCube();
MatStack.popMatrix();
MatStack.matrixMode(tgt::MatrixStack::PROJECTION);
MatStack.popMatrix();
MatStack.matrixMode(tgt::MatrixStack::MODELVIEW);
MatStack.popMatrix();
}
示例7: glPushMatrix
/*!
* \brief where points are draw and point of view set.
*/
void FrameGL::paintGL()
{
glPushMatrix();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
// Se seleeciona el punto de vista desde donde se mira.
//float ptoVista[3]={-50.f,-100.f,-1000.f};
// Define una transformacion de vision.Punto de vista XYZ, centro de la
// escena donde se mira XYZ y vector de direccion ascendente
//gluLookAt(ptoVista[0],ptoVista[1],ptoVista[2],0.0,0.0,5000.0,0.0,-1.0,0.0);
gluLookAt(-7*anglex, -7*angley-1000,-3000.0, 0.0,-1000.0,3000.0, 0.0,-1.0,0.0);
glScalef(zoom, zoom, 1);
//glRotatef(m_x,1.0f, 0.0f, 0.0f); // Rotacion X (ángulo, vector alrededor del que giras)
//glRotatef(m_y,0.0f, 1.0f, 0.0f); // Rotacion Y
drawAxis();
drawCloud();
//drawLines();//el de Raul Alves
glPopMatrix();
}
示例8: Vector3f
void GLWidget::paintGL(){
// Lights
bulb.pos = freeCam.pos;
bulb.pos.u = 1.0;
// Camera
freeCam.ar = aspectRatio;
if( !getQuaternion())
freeCam.eye = freeCam.pos + Vector3f( sin(camP)*cos(camT), sin(camT), cos(camP)*cos(camT));
setActiveCamera( freeCam);
if( getQuaternion())
setActiveViewTrackBall( m_trackBalls);
stoma.isHidden = !drawWithTexture;
render3dObjects();
if( drawGraph)
stoma.drawGraph();
if( isAxisDrawn)
{
glPushMatrix();
glTranslatef(80.0,130.0,0.0);
drawAxis();
glPopMatrix();
}
swapBuffers();
}
示例9: main
/*
Enter n for polygon
5
Enter points of polygon in clockwise/anticlockwise order\n
-20 50
50 200
120 50
50 -200
-20 50
Enter rectangle
0 -100 100 150
*/
int main()
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "");
setbkcolor(WHITE);
cleardevice();
drawAxis(BLACK);
int n;
Poly *head = NULL;
printf("Enter n for polygon");
scanf("%d", &n);
printf("Enter points of polygon in clockwise/anticlockwise order\n");
for(int i = 0; i<n; i++)
{
Point p;
scanf("%lf%lf",&p.x,&p.y);
Poly *x = (Poly *) malloc (sizeof(Poly));
*x = {p, head};
head = x;
}
head->plotPoly(MAGENTA,0);
Rect r;
printf("Enter rectangle\n");
scanf("%lf%lf%lf%lf",&r.min.x, &r.min.y, &r.max.x, &r.max.y);
r.plotRect(BLUE);
Poly *op = sutherlandHodgeman(head, &r);
op->plotPoly(YELLOW,0);
getch();
return 0;
}
示例10: glClear
void GLWidget::paintGL() {
std::cout << "paintGL()" << std::endl;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//================================
// OpenGLの座標系を動かして描画
//================================
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//初期状態では画面右がx,上がy,手前がz
// z軸を上,x軸を手前にする
glRotated(-90, 1, 0, 0);
glRotated(-90, 0, 0, 1);
glTranslatef(-5, 0.0, 0.0);
// 描画設定
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
//軸の描写
glPushMatrix();
glLineWidth(2);
drawAxis();
glPopMatrix();
glDisable(GL_BLEND);
glDisable(GL_COLOR_MATERIAL);
//全ての処理を実行
glFlush();
}
示例11: main
/*
-30 70
60 100
80 -10
20 -20
-80 0
-30 70
Enter line
-150 100
150 20
-30 70
60 100
80 -10
20 -20
-80 0
-30 70
Enter line
*/
int main()
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "");
setbkcolor(WHITE);
cleardevice();
drawAxis(BLACK);
int n;
Poly *poly = NULL;
printf("Enter n for convex polygon\n");
scanf("%d", &n);
printf("Enter points in clockwise/anticlockwise order\n");
for(int i = 0; i<n; i++)
{
int x,y;
scanf("%d%d",&x,&y);
Point p = Point{x,y};
Poly *newPoly = (Poly *)malloc(sizeof(Poly));
*newPoly = Poly{p, poly};
poly = newPoly;
}
poly->plotPoly(BLACK, 0);
printf("Enter line\n");
Line l;
scanf("%lf%lf%lf%lf", &l.p1.x, &l.p1.y, &l.p2.x, &l.p2.y);
l.plotLineDDA(BLUE);
cyrusBeck(poly, &l, YELLOW);
getch();
closegraph();
return 0;
}
示例12: display
void display(void)
{
int i,k;
glColor3f(1.0,1.0,1.0) ;
glClear(GL_COLOR_BUFFER_BIT);
drawAxis () ;
glColor3f( 1,0,0);
for(i=0;i<n;i++)
{
y[i] = 0 ;
for(k=1;k<=i;k++)
{
y[i] += - a[k]*y[i-k] ;
}
for(k=0;k<=i;k++)
{
y[i] += b[k]*U(i-k) ;
}
}
for(i=0;i<n;i++)
drawPixel(i*10,y[i]*1.0);
glFlush();
}
示例13: Mat
void DrawAxis::openWebcam()
{
webcam.open(0);
webcam.set(CV_CAP_PROP_FRAME_WIDTH, frameWidth);
webcam.set(CV_CAP_PROP_FRAME_HEIGHT, frameHeight);
rvec = Mat(Size(3, 1), CV_64F);
tvec = Mat(Size(3, 1), CV_64F);
cout << "intrinsinc = " << intrinsic_params << endl;
cout << "dist = " << distortion_params << endl;
cout << "intrinsic.size = " << intrinsic_params.size() << endl;
while (true){
webcam.read(webcamImage);
bool findCorners = findChessboardCorners(webcamImage, boardSize, corners, CALIB_CB_FAST_CHECK);
if (findCorners){
solvePnP(Mat(boardPoints), Mat(corners), intrinsic_params, distortion_params, rvec, tvec, false);
projectPoints(cubePoints, rvec, tvec, intrinsic_params, distortion_params, cubeFramePoints);
projectPoints(framePoints, rvec, tvec, intrinsic_params, distortion_params, imageFramePoints);
drawAxis(webcamImage, color, 3);
drawCube(webcamImage, cubeFramePoints, Scalar(255, 0, 255), 2);
}
namedWindow("OpenCV Webcam", 0);
imshow("OpenCV Webcam", webcamImage);
waitKey(10);
}
}
示例14: main
int main(void)
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "");
setbkcolor(WHITE);
cleardevice();
drawAxis(BLACK);
setcolor(BLACK);
int x1, y1, x2, y2;
printf("Enter line1(midpoint)\n");
scanf("%d%d%d%d",&x1,&y1,&x2, &y2);
Line l1 = Line{Point{x1, y1}, Point{x2,y2}};
outtextxy(x1+XREF,-y1+YREF,"midpoint algorithm");
printf("Enter line2(dda)");
scanf("%d%d%d%d",&x1,&y1,&x2, &y2);
Line l2 = Line{Point{x1, y1}, Point{x2,y2}};
outtextxy(x1+XREF,-y1+YREF,"dda algorithm");
printf("Enter line2(bressenham)");
scanf("%d%d%d%d",&x1,&y1,&x2, &y2);
Line l3 = Line{Point{x1, y1}, Point{x2,y2}};
outtextxy(x1+XREF,-y1+YREF,"bressenham algorithm");
l1.plotLineMidPt(BLACK);
l2.plotLineDDA(BLACK);
l3.plotLineBressen(BLACK);
getch();
closegraph();
return 0;
}
示例15: myDisplay
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
drawAxis();
drawSin();
glFlush();
}