Exemple #1
0
def doSpecial(*args):
    global cameraMatrix
    glutMouseFunc(click)
    if glutGetModifiers() & GLUT_ACTIVE_SHIFT:
        if args[0] == GLUT_KEY_UP:
            cameraMatrix = cameraMatrix * matrices.translate(
                0, -translateFactor, 0)  # MOVE UP
        if args[0] == GLUT_KEY_DOWN:
            cameraMatrix = cameraMatrix * matrices.translate(
                0, translateFactor, 0)  # MOVE DOWN
        if args[0] == GLUT_KEY_LEFT:
            cameraMatrix = cameraMatrix * matrices.translate(
                translateFactor, 0, 0)  # MOVE LEFT
        if args[0] == GLUT_KEY_RIGHT:
            cameraMatrix = cameraMatrix * matrices.translate(
                -translateFactor, 0, 0)  # MOVE RIGHT
    else:
        if args[0] == GLUT_KEY_UP:
            cameraMatrix = cameraMatrix * matrices.rotateX(
                -rotateFactor)  # ROTATE UP
        if args[0] == GLUT_KEY_DOWN:
            cameraMatrix = cameraMatrix * matrices.rotateX(
                rotateFactor)  # ROTATE DOWN
        if args[0] == GLUT_KEY_LEFT:
            cameraMatrix = cameraMatrix * matrices.rotateY(
                -rotateFactor)  # ROTATE LEFT
        if args[0] == GLUT_KEY_RIGHT:
            cameraMatrix = cameraMatrix * matrices.rotateY(
                rotateFactor)  # ROTATE RIGHT
    doRedraw()
Exemple #2
0
def doSpecial(*args):
	global cameraMatrix
	if glutGetModifiers() & GLUT_ACTIVE_SHIFT:
		if args[0] == GLUT_KEY_UP:
			cameraMatrix = cameraMatrix*matrices.translate(0, -translateFactor, 0) #up
		if args[0] == GLUT_KEY_DOWN:
			cameraMatrix = cameraMatrix*matrices.translate(0, translateFactor, 0) #down
		if args[0] == GLUT_KEY_LEFT:
			cameraMatrix = cameraMatrix*matrices.translate(translateFactor, 0, 0) #left
		if args[0] == GLUT_KEY_RIGHT:
			cameraMatrix = cameraMatrix*matrices.translate(-translateFactor, 0, 0) #right
	else:
		if args[0] == GLUT_KEY_UP:
			cameraMatrix = cameraMatrix*matrices.rotateX(-rotateFactor) #up
		if args[0] == GLUT_KEY_DOWN:
			cameraMatrix = cameraMatrix*matrices.rotateX(rotateFactor) #down
		if args[0] == GLUT_KEY_LEFT:
			cameraMatrix = cameraMatrix*matrices.rotateY(-rotateFactor) #left
		if args[0] == GLUT_KEY_RIGHT:
			cameraMatrix = cameraMatrix*matrices.rotateY(rotateFactor) #right
	doRedraw()
Exemple #3
0
    def from_extrude_curve(cls, curve, vector):

        i, j = curve.ctrl_pnts.shape
        ctrl_pnt = np.zeros((i, 2, j), np.double)

        ctrl_pnt[:, 0] = curve.ctrl_pnts.copy()

        matrix = matrices.translate(vector)
        ctrl_pnt[:, 1] = np.dot(matrix, ctrl_pnt[:, 0].transpose()).transpose()

        knot_u = curve.knots.copy()
        knot_v = np.asarray([0, 0, 1, 1], dtype=np.double)

        return cls(ctrl_pnt, knot_u, knot_v)
Exemple #4
0
    def from_extrude_curve(cls, curve, vector):

        i, j = curve.ctrl_pnts.shape
        ctrl_pnt = np.zeros((i, 2, j), np.double)

        ctrl_pnt[:, 0] = curve.ctrl_pnts.copy()

        matrix = matrices.translate(vector)
        ctrl_pnt[:, 1] = np.dot(matrix, ctrl_pnt[:, 0].transpose()).transpose()

        knot_u = curve.knots.copy()
        knot_v = np.asarray([0, 0, 1, 1], dtype=np.double)

        return cls(ctrl_pnt, knot_u, knot_v)