void Motion(int x,int y) { if(button==GLUT_DOWN) { double dx,dy; YsVec3 vec; dx=double(x-lastX); dy=double(lastY-y); switch(mouseMode) { case 0: eyeAtt.NoseUp(dy/300.0); eyeAtt.YawLeft(-dx/300.0); break; case 1: vec.Set(-dx/30.0,-dy/30.0,0.0); vec=eyeAtt.GetMatrix()*vec; eyeLookAt=eyeLookAt+vec; break; } glutPostRedisplay(); } lastX=x; lastY=y; }
void YsClassSample::Display(void) { BIPOSATT biEyePos; BIPOINT cursor; eyePos.Set(0.0,0.0,-eyeDistance); eyePos=eyeAtt.GetMatrix()*eyePos; eyePos=eyeLookAt+eyePos; BiSetPoint(&biEyePos.p,eyePos.x(),eyePos.y(),eyePos.z()); BiSetAngleDeg(&biEyePos.a, YsRadToDeg(eyeAtt.h()), YsRadToDeg(eyeAtt.p()), YsRadToDeg(eyeAtt.b())); BiClearScreen(); BiStartBuffer(&biEyePos); BiSetPoint(&cursor, pointOfInterest.x(), pointOfInterest.y(), pointOfInterest.z()); BiInsMarker(&cursor,&BiWhite,BIMK_CROSS); DrawSlashedPolygon(); DrawPolygon(4,q,blu,YSFALSE); DrawPolygon(4,r,blu,YSFALSE); DrawAxis(5.0); BiFlushBuffer(); BiSwapBuffers(); }
void YsClassSample::Motion(int x,int y) { double dx,dy; YsVec3 vec; dx=double(x-lastX); dy=double(lastY-y); switch(mouseMode) { case 0: eyeAtt.NoseUp(dy/300.0); eyeAtt.YawLeft(-dx/300.0); break; case 1: vec.Set(-dx/30.0,-dy/30.0,0.0); vec=eyeAtt.GetMatrix()*vec; eyeLookAt=eyeLookAt+vec; break; case 2: RotatePolygon(p,dy/300.0,-dx/300.0); break; case 3: RotatePolygon(q,dy/300.0,-dx/300.0); break; case 4: RotatePolygon(r,dy/300.0,-dx/300.0); break; } lastX=x; lastY=y; }
void Display(void) { double matBuf[4*4]; YsVec3 eyePos; YsMatrix4x4 eyeTfm; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); eyePos.Set(0.0,0.0,eyeDistance); eyePos=eyeAtt.GetMatrix()*eyePos; eyeTfm.Initialize(); eyeTfm.Translate(eyePos); eyeTfm.Rotate(eyeAtt); eyeTfm.Invert(); eyeTfm.Translate(-eyeLookAt); eyeTfm.GetArray(matBuf); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMultMatrixd(matBuf); DrawShell(sh1,blu,drawInPolygon); DrawShell(sh2,grn,drawInPolygon); DrawAxis(5.0); glFlush(); glutSwapBuffers(); }
void Display(void) { double matBuf[4*4]; YsVec3 eyePos; YsMatrix4x4 eyeTfm; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); eyePos.Set(0.0,0.0,eyeDistance); eyePos=eyeAtt.GetMatrix()*eyePos; eyeTfm.Initialize(); eyeTfm.Translate(eyePos); eyeTfm.Rotate(eyeAtt); eyeTfm.Invert(); eyeTfm.Translate(-eyeLookAt); eyeTfm.GetArray(matBuf); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMultMatrixd(matBuf); DrawSeparatablePair(nVtx,vtx); glFlush(); glutSwapBuffers(); }
YSRESULT YsCollisionOfPolygon::PrecomputeProjectionOfPolygon2(void) { if(np2>0 && p2!=NULL) { if(pln2.GetNormal()!=YsOrigin()) { YsAtt3 att; YsVec3 prj; YsBoundingBoxMaker2 makeBbx; int i; att.SetForwardVector(pln2.GetNormal()); att.GetMatrix4x4(p2PrjMat); p2PrjMat.Invert(); p2PrjMat.Translate(-pln2.GetOrigin()); p2Prj.Set(np2,NULL); makeBbx.Begin(); for(i=0; i<np2; i++) { prj=p2PrjMat*p2[i]; p2Prj[i].GetXY(prj); makeBbx.Add(p2Prj[i]); } makeBbx.Get(p2PrjMin,p2PrjMax); return YSOK; } else { YsErrOut("YsCollisionOfPolygon::PrecomputeProjectionOfPolygon2()\n"); YsErrOut(" Normal of polygon2 is not set.\n"); return YSERR; } } else { YsErrOut("YsCollisionOfPolygon::PrecomputeProjectionOfPolygon2()\n"); YsErrOut(" This function must be called after SetPolygon2()\n"); return YSERR; } }
void MoveShell(YsShell &sh,YsVec3 &mov) { YsMatrix4x4 mat,trn,viw,iViw; sh.GetMatrix(mat); viw=eyeAtt.GetMatrix(); iViw=viw; iViw.Invert(); trn.Initialize(); trn.Translate(mov); mat=viw*trn*iViw*mat; sh.SetMatrix(mat); }
void RotateShell(YsShell &sh,double pitch,double yaw) { YsMatrix4x4 mat,rot,viw,iViw; sh.GetMatrix(mat); viw=eyeAtt.GetMatrix(); iViw=viw; iViw.Invert(); rot.Initialize(); rot.RotateZY(pitch); rot.RotateXZ(yaw); mat=viw*rot*iViw*mat; sh.SetMatrix(mat); }
void Display(void) { double matBuf[4*4]; YsVec3 eyePos; YsMatrix4x4 eyeTfm; YsVec3 p; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); eyePos.Set(0.0,0.0,eyeDistance); eyePos=eyeAtt.GetMatrix()*eyePos; eyeTfm.Initialize(); eyeTfm.Translate(eyePos); eyeTfm.Rotate(eyeAtt); eyeTfm.Invert(); eyeTfm.Translate(-eyeLookAt); eyeTfm.GetArray(matBuf); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMultMatrixd(matBuf); DrawAxis(5.0); glDisable(GL_LIGHTING); glColor3d(1.0,1.0,1.0); glBegin(GL_LINES); glVertex3d(0.0,0.0,0.0); glVertex3d(axisOfOrbit.x()*5.0,axisOfOrbit.y()*5.0,axisOfOrbit.z()*5.0); glEnd(); rot.RotatePositive(p,orbiter); glPushMatrix(); glTranslatef(p.x()*5.0,p.y()*5.0,p.z()*5.0); DrawCursor(); glPopMatrix(); glFlush(); glutSwapBuffers(); }
void YsClassSample::MainLoop(void) { int lb,mb,rb; long mx,my; eyeDistance=10.0; eyeLookAt.Set(0.0,0.0,0.0); eyeAtt.Set(0.0,0.0,0.0); pointOfInterest.Set(0.0,0.0,-1.0); PrepareSquare(p); PrepareSquare(q); RotatePolygon(q,YsDegToRad(90.0),0.0); PrepareSquare(r); RotatePolygon(r,0.0,YsDegToRad(90.0)); BiMouse(&lb,&mb,&rb,&mx,&my); mouseMode=0; while((key=BiInkey())!=BIKEY_ESC) { BIPROJ prj; BiUpdateDevice(); BiGetStdProjection(&prj); BiSetProjection(&prj); Key(key); Display(); lastX=mx; lastY=my; BiMouse(&lb,&mb,&rb,&mx,&my); if(lb==BI_ON && (mx!=lastX || my!=lastY)) { Motion(mx,my); } } }
int main(int argc, char** argv) { InitYsClass(); PrepareShell(sh1); PrepareShell(sh2); printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("C....Rotate Shell 1\n"); printf("D....Move Shell 1\n"); printf("E....Rotate Shell 2\n"); printf("F....Move Shell 2\n"); printf("G....Polygon/Wireframe\n"); printf("O....Or(UNION)\n"); printf("I....And(INTERSECTION)\n"); printf("S....Minus(DIFFERENCE)\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); eyeAtt.Set(0.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }
int main(int argc, char** argv) { InitYsClass(); PrepareSquare(p); PrepareSquare(q); RotatePolygon(q,YsDegToRad(90.0),0.0); PrepareSquare(r); RotatePolygon(r,0.0,YsDegToRad(90.0)); printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("C....Rotate polygon 1(Target Polygon)\n"); printf("D....Rotate polygon 2(Slasher)\n"); printf("E....Rotate polygon 3(Slasher)\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); mouseMode=3; eyeAtt.Set(0.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }
int main(int argc, char** argv) { InitYsClass(); axisOfOrbit.Set(1.0,1.0,1.0); axisOfOrbit.Normalize(); orbiter=axisOfOrbit.GetArbitraryParpendicularVector(); orbiter.Normalize(); rot.Set(axisOfOrbit,0.0); printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); eyeAtt.Set(YsPi/2.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }
int main(int argc, char** argv) { int i; InitYsClass(); for(i=0; i<nVtx; i++) { vtx[i].Set(&v[i*3]); } printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); eyeAtt.Set(0.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }
void FsGui3DInterface::Draw(void) const { needRedraw=YSFALSE; if(type==IFTYPE_BOX) { YsVec3 cen,o; glColor3d(0.0,1.0,0.0); glEnable(GL_LINE_STIPPLE); glLineStipple(1,0xf0f0); glBegin(GL_LINES); glVertex3d(box_pos[0].x(),box_pos[0].y(),box_pos[0].z()); glVertex3d(box_pos[1].x(),box_pos[0].y(),box_pos[0].z()); glVertex3d(box_pos[1].x(),box_pos[0].y(),box_pos[0].z()); glVertex3d(box_pos[1].x(),box_pos[1].y(),box_pos[0].z()); glVertex3d(box_pos[1].x(),box_pos[1].y(),box_pos[0].z()); glVertex3d(box_pos[0].x(),box_pos[1].y(),box_pos[0].z()); glVertex3d(box_pos[0].x(),box_pos[1].y(),box_pos[0].z()); glVertex3d(box_pos[0].x(),box_pos[0].y(),box_pos[0].z()); glVertex3d(box_pos[0].x(),box_pos[0].y(),box_pos[1].z()); glVertex3d(box_pos[1].x(),box_pos[0].y(),box_pos[1].z()); glVertex3d(box_pos[1].x(),box_pos[0].y(),box_pos[1].z()); glVertex3d(box_pos[1].x(),box_pos[1].y(),box_pos[1].z()); glVertex3d(box_pos[1].x(),box_pos[1].y(),box_pos[1].z()); glVertex3d(box_pos[0].x(),box_pos[1].y(),box_pos[1].z()); glVertex3d(box_pos[0].x(),box_pos[1].y(),box_pos[1].z()); glVertex3d(box_pos[0].x(),box_pos[0].y(),box_pos[1].z()); glVertex3d(box_pos[0].x(),box_pos[0].y(),box_pos[0].z()); glVertex3d(box_pos[0].x(),box_pos[0].y(),box_pos[1].z()); glVertex3d(box_pos[1].x(),box_pos[0].y(),box_pos[0].z()); glVertex3d(box_pos[1].x(),box_pos[0].y(),box_pos[1].z()); glVertex3d(box_pos[1].x(),box_pos[1].y(),box_pos[0].z()); glVertex3d(box_pos[1].x(),box_pos[1].y(),box_pos[1].z()); glVertex3d(box_pos[0].x(),box_pos[1].y(),box_pos[0].z()); glVertex3d(box_pos[0].x(),box_pos[1].y(),box_pos[1].z()); glEnd(); glDisable(GL_LINE_STIPPLE); cen=(box_pos[0]+box_pos[1])/2.0; glPointSize(float(markerSize)); glLineWidth(float(linePickingTolerance)); o.Set(box_pos[0].x(),cen.y(),cen.z()); glBegin(GL_POINTS); glVertex3dv(o.GetValue()); glEnd(); DrawLineByPixelLength(o,YsVec3( 1.0,0.0,0.0),pickerLength); DrawLineByPixelLength(o,YsVec3(-1.0,0.0,0.0),pickerLength); o.Set(box_pos[1].x(),cen.y(),cen.z()); glBegin(GL_POINTS); glVertex3dv(o.GetValue()); glEnd(); DrawLineByPixelLength(o,YsVec3( 1.0,0.0,0.0),pickerLength); DrawLineByPixelLength(o,YsVec3(-1.0,0.0,0.0),pickerLength); o.Set(cen.x(),box_pos[0].y(),cen.z()); glBegin(GL_POINTS); glVertex3dv(o.GetValue()); glEnd(); DrawLineByPixelLength(o,YsVec3(0.0, 1.0,0.0),pickerLength); DrawLineByPixelLength(o,YsVec3(0.0,-1.0,0.0),pickerLength); o.Set(cen.x(),box_pos[1].y(),cen.z()); glBegin(GL_POINTS); glVertex3dv(o.GetValue()); glEnd(); DrawLineByPixelLength(o,YsVec3(0.0, 1.0,0.0),pickerLength); DrawLineByPixelLength(o,YsVec3(0.0,-1.0,0.0),pickerLength); o.Set(cen.x(),cen.y(),box_pos[0].z()); glBegin(GL_POINTS); glVertex3dv(o.GetValue()); glEnd(); DrawLineByPixelLength(o,YsVec3(0.0,0.0, 1.0),pickerLength); DrawLineByPixelLength(o,YsVec3(0.0,0.0,-1.0),pickerLength); o.Set(cen.x(),cen.y(),box_pos[1].z()); glBegin(GL_POINTS); glVertex3dv(o.GetValue()); glEnd(); DrawLineByPixelLength(o,YsVec3(0.0,0.0, 1.0),pickerLength); DrawLineByPixelLength(o,YsVec3(0.0,0.0,-1.0),pickerLength); glPointSize(1); glLineWidth(1); if(dragging==YSTRUE) { switch(box_dragging) { case BOX_XMIN: glBegin(GL_LINES); glVertex3d(box_pos[0].x()-infiniteLongLine,cen.y(),cen.z()); glVertex3d(box_pos[0].x()+infiniteLongLine,cen.y(),cen.z()); glEnd(); break; case BOX_XMAX: glBegin(GL_LINES); glVertex3d(box_pos[1].x()-infiniteLongLine,cen.y(),cen.z()); glVertex3d(box_pos[1].x()+infiniteLongLine,cen.y(),cen.z()); glEnd(); break; case BOX_YMIN: glBegin(GL_LINES); glVertex3d(cen.x(),box_pos[0].y()-infiniteLongLine,cen.z()); glVertex3d(cen.x(),box_pos[0].y()+infiniteLongLine,cen.z()); glEnd(); break; case BOX_YMAX: glBegin(GL_LINES); glVertex3d(cen.x(),box_pos[1].y()-infiniteLongLine,cen.z()); glVertex3d(cen.x(),box_pos[1].y()+infiniteLongLine,cen.z()); glEnd(); break; case BOX_ZMIN: glBegin(GL_LINES); glVertex3d(cen.x(),cen.y(),box_pos[0].z()-infiniteLongLine); glVertex3d(cen.x(),cen.y(),box_pos[0].z()+infiniteLongLine); glEnd(); break; case BOX_ZMAX: glBegin(GL_LINES); glVertex3d(cen.x(),cen.y(),box_pos[1].z()-infiniteLongLine); glVertex3d(cen.x(),cen.y(),box_pos[1].z()+infiniteLongLine); glEnd(); break; } } } else if(type==IFTYPE_POINT) { glColor3d(0.0,1.0,0.0); glBegin(GL_LINE_STRIP); switch(point_dlg1->GetBasePlane()) { case 0: glVertex3d(point_pos.x(),point_pos.y(),point_pos.z()); glVertex3d(point_pos.x(),point_pos.y(),0.0); glVertex3d(point_pos.x(),0.0 ,0.0); glVertex3d(0.0 ,0.0 ,0.0); glVertex3d(0.0 ,point_pos.y(),0.0); glVertex3d(point_pos.x(),point_pos.y(),0.0); break; case 1: glVertex3d(point_pos.x(),point_pos.y(),point_pos.z()); glVertex3d(point_pos.x(),0.0 ,point_pos.z()); glVertex3d(0.0 ,0.0 ,point_pos.z()); glVertex3d(0.0 ,0.0 ,0.0); glVertex3d(point_pos.x(),0.0 ,0.0); glVertex3d(point_pos.x(),0.0 ,point_pos.z()); break; case 2: glVertex3d(point_pos.x(),point_pos.y(),point_pos.z()); glVertex3d(0.0 ,point_pos.y(),point_pos.z()); glVertex3d(0.0 ,0.0 ,point_pos.z()); glVertex3d(0.0 ,0.0 ,0.0); glVertex3d(0.0 ,point_pos.y(),0.0); glVertex3d(0.0 ,point_pos.y(),point_pos.z()); break; } glEnd(); auto nom=point_dlg1->GetNormalDirection(); if(POINT_Y==point_dragging) { glPushAttrib(GL_ENABLE_BIT); glLineWidth(1); glEnable(GL_LINE_STIPPLE); glLineStipple(1,0x0003); glBegin(GL_LINES); glVertex3dv((point_pos-nom*infiniteLongLine).GetValue()); glVertex3dv((point_pos+nom*infiniteLongLine).GetValue()); glEnd(); glPopAttrib(); } glLineWidth(float(linePickingTolerance)); DrawLineByPixelLength(point_pos, nom,pickerLength); DrawLineByPixelLength(point_pos,-nom,pickerLength); glLineWidth(float(1)); DrawRectMarker(point_pos,markerSize); } else if(type==IFTYPE_DRAGPOINT) { glColor3d(0.0,1.0,0.0); glPointSize(float(markerSize)); glBegin(GL_POINTS); glVertex3dv(point_pos.GetValue()); glEnd(); glPointSize(1); YsVec3 dragDir[3]; if(YSTRUE==point_dlg2->UseCustomOrientation()) { dragDir[0]=point_dragDir[0]; dragDir[1]=point_dragDir[1]; dragDir[2]=point_dragDir[2]; } else { dragDir[0]=YsXVec(); dragDir[1]=YsYVec(); dragDir[2]=YsZVec(); } const DRAGTARGET pointDragTarget[3]= { POINT_X, POINT_Y, POINT_Z }; int i; for(i=0; i<3; i++) { if(point_dragDirSwitch[i]==YSTRUE) { glLineWidth(float(linePickingTolerance)); DrawLineByPixelLength(point_pos, dragDir[i],pickerLength); DrawLineByPixelLength(point_pos,-dragDir[i],pickerLength); } if(dragging==YSTRUE && point_dragging==pointDragTarget[i]) { glPushAttrib(GL_ENABLE_BIT); glLineWidth(1); glEnable(GL_LINE_STIPPLE); glLineStipple(1,0x0003); glBegin(GL_LINES); glVertex3dv((point_pos-dragDir[i]*infiniteLongLine).GetValue()); glVertex3dv((point_pos+dragDir[i]*infiniteLongLine).GetValue()); glEnd(); glPopAttrib(); } } glLineWidth(1); } else if(type==IFTYPE_SLIDER) { } else if(type==IFTYPE_ROTATION) { if(dragging==YSTRUE) { glColor3d(1.0,0.0,5.0); } else { glColor3d(0.0,1.0,0.0); } glLineWidth(3); glBegin(GL_LINES); glVertex3dv((rot_center+rot_axis*infiniteLongLine).GetValue()); glVertex3dv((rot_center-rot_axis*infiniteLongLine).GetValue()); glEnd(); glLineWidth(1); YsVec3 iVec=rot_iVec; YsVec3 jVec=rot_jVec; YsVec3 kVec=rot_kVec; YsMatrix4x4 mat,axisMat; YsAtt3 att; att.SetForwardVector(rot_axis); att.GetMatrix4x4(axisMat); mat.Initialize(); mat.Rotate(rot_axis.x(),rot_axis.y(),rot_axis.z(),rot_angle); mat=mat*axisMat; mat.Scale(1.0,1.0,rot_mirror); mat.Scale(rot_ref_size,rot_ref_size,rot_ref_size); axisMat.Invert(); mat=mat*axisMat; iVec=mat*iVec; jVec=mat*jVec; kVec=mat*kVec; glBegin(GL_LINES); for(int i=0; i<360; i+=30) { YsVec3 p[2]; double a; a=YsPi*2.0*double(i)/360.0; p[0]=rot_center+iVec*cos(a)+jVec*1.0+kVec*sin(a); p[1]=rot_center+iVec*cos(a)-jVec*1.0+kVec*sin(a); glVertex3dv(p[0].GetValue()); glVertex3dv(p[1].GetValue()); } glEnd(); glBegin(GL_LINE_LOOP); for(int i=0; i<360; i+=10) { double a; YsVec3 p; a=YsPi*2.0*double(i)/360.0; p=rot_center+iVec*cos(a)+jVec*1.0+kVec*sin(a); glVertex3dv(p.GetValue()); } glEnd(); glBegin(GL_LINE_LOOP); for(int i=0; i<360; i+=10) { double a; YsVec3 p; a=YsPi*2.0*double(i)/360.0; p=rot_center+iVec*cos(a)-jVec*1.0+kVec*sin(a); glVertex3dv(p.GetValue()); } glEnd(); // Side drag marker const YsVec3 sideX=rot_drag_dir*rot_ref_size*1.1; const YsVec3 sideY=(rot_drag_dir^rot_axis)*rot_ref_size*1.1; glLineWidth(3); glBegin(GL_LINE_LOOP); for(int i=0; i<360; i+=10) { const double a=YsPi*2.0*double(i)/360.0; YsVec3 p; p=rot_center+sideX*cos(a)+sideY*sin(a); glVertex3dv(p); } glEnd(); if(ROTATION_HANDLE==rot_dragging) { glBegin(GL_LINES); glVertex3dv(rot_center); const YsVec3 radial=rot_ref_size*1.1*(rot_iVec*cos(rot_drag_angle)-rot_kVec*sin(rot_drag_angle)); glVertex3dv(rot_center+radial); glEnd(); } glLineWidth(1); } }