Exemple #1
0
def make_cone(radius, height, slices):
    profile = [
        V3.make(0.0, 0.0, 0.0),
        V3.make(radius, 0.0, 0.0),
        V3.make(0.0, height, 0.0)
    ]
    return profile_sweep(profile, slices)
Exemple #2
0
 def __init__(self, material_name):
     self.name = material_name
     self.Ks = V3.make(0.7, 0.7, 0.7)  # Specular color
     self.Kd = V3.make(0.7, 0.7, 0.7)  # Diffuse color
     self.Ka = V3.make(0.7, 0.7, 0.7)  # Ambient color
     self.specular_exponent = 100.0  # Specular power
     self.wire_color = V3.make(0.7, 0.0, 0.7)
     self.wire_thickness = 2.0
Exemple #3
0
def make_conical(bottom_radius, top_radius, height, slices):
    profile = [
        V3.make(0.0, 0.0, 0.0),
        V3.make(bottom_radius, 0.0, 0.0),
        V3.make(top_radius, height, 0.0),
        V3.make(0.0, height, 0.0)
    ]
    return profile_sweep(profile, slices)
Exemple #4
0
def make_cylinder(radius, height, slices):
    profile = [
        V3.make(0.0, -height / 2.0, 0.0),
        V3.make(radius, -height / 2.0, 0.0),
        V3.make(radius, height / 2.0, 0.0),
        V3.make(0.0, height / 2.0, 0.0)
    ]
    return profile_sweep(profile, slices)
Exemple #5
0
 def __init__(self, index):
     self.index = index
     self.position = V3.make(0.0, 100.0, 0.0)  # Position of light in world
     self.target = V3.make(0.0, 0.0,
                           0.0)  # Position of light target in world
     self.cutoff_angle = 45.0
     self.attenuation = 0.01
     self.Is = V3.make(1.0, 1.0, 1.0)  # Specular color
     self.Id = V3.make(0.7, 0.7, 0.7)  # Diffuse color
     self.Ia = V3.make(0.2, 0.2, 0.2)  # Ambient color
Exemple #6
0
def make_capsule(radius, height, slices, segments):
    profile = [V3.zero() for _ in range(segments)]
    dtheta = pi / (segments - 1)
    for i in range(segments):
        theta = dtheta * i
        R = Q.Ru(theta, V3.k())
        dh = -height / 2.0 if i < (segments / 2) else height / 2.0
        profile[i] = Q.rotate(R, V3.make(0.0, -radius, 0.0)) + V3.make(
            0.0, dh, 0.0)
    return profile_sweep(profile, slices)
Exemple #7
0
def make_sphere(radius, slices, segments):
    profile = [V3.zero() for _ in range(segments)]
    dtheta = pi / (segments - 1)
    for i in range(segments):
        theta = dtheta * i
        R = Q.Ru(theta, V3.k())
        profile[i] = Q.rotate(R, V3.make(0.0, -radius, 0.0))
    return profile_sweep(profile, slices)
Exemple #8
0
def make_box(width, height, depth):
    p0 = V3.make(-width, -height, depth) * 0.5
    p1 = V3.make(width, -height, depth) * 0.5
    p2 = V3.make(width, height, depth) * 0.5
    p3 = V3.make(-width, height, depth) * 0.5
    p4 = p0 - V3.make(0.0, 0.0, depth)
    p5 = p1 - V3.make(0.0, 0.0, depth)
    p6 = p2 - V3.make(0.0, 0.0, depth)
    p7 = p3 - V3.make(0.0, 0.0, depth)
    return make_cuboid(p0, p1, p2, p3, p4, p5, p6, p7)