示例#1
0
    def reproject(self, rot):
        self.prj = Matrix4()
        self.prj.scale(self.tile_size, self.tile_size, 1.0)
        self.prj.rotate_axis(math.radians(60), Vector3(1, 0, 0))
        self.prj.rotate_axis(rot, Vector3(0, 0, 1))

        self.inv_prj = Matrix4()
        self.inv_prj.scale(self.tile_size, self.tile_size / 2, 1.0)
        self.inv_prj.rotate_axis(rot, Vector3(0, 0, 1))
        self.inv_prj = self.inv_prj.inverse()
示例#2
0
    def __init__(self, window):
        self.fov = math.radians(50)
        self.clipnear = 0.1
        self.clipfar = 100000

        self.needs_update = True

        self.params = {}

        self.window = window
        handlers = CameraHandler(window, self)
        window.push_handlers(handlers)

        self.center = Point3(0, 0, 0)
        self.matrix = Matrix4().new_rotate_axis(math.pi * -0.1, Vector3(
            1, 0, 0)).translate(0, 0.0, 6)
        self.matrixinv = self.matrix.inverse()
        self.persp_matrix = Matrix4()
示例#3
0
def getPosition(lerpParameter):
    A = getClothoidConstant()

    signY = 1

    # flip clothoid vertical if clockwise or endCurvature<startCurvature
    if (clockwise and startCurvature < endCurvature) or (
            not clockwise and endCurvature < startCurvature):
        signY = -1
    else:
        signY = 1

    # calculate length on clothoid at start- and endpoint
    smallerLength = A * A * startCurvature
    greaterLength = A * A * endCurvature

    # calculate length on clothoid at interpolation point
    currentLength = lerp(smallerLength, greaterLength, lerpParameter)

    # calculate clothoid coordinates in local system
    localX = computeX(currentLength, A) - computeX(smallerLength, A)
    localY = signY * (computeY(currentLength, A) - computeY(smallerLength, A))

    # calculate the global rotation angle and create rotation matrix
    rotation = Matrix4()
    rotation = rotation.rotatez(calculateGlobalRotation())

    #print("python: " + str(calculateGlobalRotation()))

    # rotate point with global rotation angle
    tP_3 = rotation.transform(Vector3(localX, localY, 0))
    tP = Vector2(tP_3.x, tP_3.y)

    # output global coordinates on clothoid intersection point
    if startCurvature < endCurvature:
        return tP + start
    elif endCurvature < startCurvature:
        return start - tP
    else:
        raise (-66)