Ejemplo n.º 1
0
void mouse( int button, int state, int x, int y ) {
    if( button == GLUT_LEFT_BUTTON && !State.inAnimation && !State.inRotation ) {
        if( state == GLUT_DOWN  ) { //pick a vertex
            Line line = View.cursorLine( x, y );
            Vector destination = Origami.pickVertex( View.cursorLine( x, y ) );
            View.world2window( destination, Cursor3D.x, Cursor3D.y, Cursor3D.z );
            glutWarpPointer( Cursor3D.x, Cursor3D.y );
            State.inFolding = true;
        } else { // GLUT_UP
            Origami.releaseVertex();
            State.inFolding = false;
        }
    }
}
Ejemplo n.º 2
0
void folding(Vector source, Vector destination)
{
	// Origami.listVertex();
	// printf("\n");

	// source.print();
	View.world2window( source, Cursor3D.x, Cursor3D.y, Cursor3D.z );

	Line line = View.cursorLine( Cursor3D.x, Cursor3D.y );
	// line.print();
	source = Origami.pickVertex( line );

	glutWarpPointer( Cursor3D.x, Cursor3D.y );
	// destination.print();
	// printf("\n");

	Origami.moveVertex( destination, View.eyePosition(), false);
	View.world2window( destination, Cursor3D.x, Cursor3D.y, Cursor3D.z );
	Origami.releaseVertex();
}