def __init__(self, ADDone, ADDtwo): super(CSGadd, self).__init__() self.ADDone = ADDone self.ADDtwo = ADDtwo self.reference = 'CSGadd' self.transform = tf.identity_matrix()
def __init__(self, INTone, INTtwo): super(CSGint, self).__init__() self.INTone = INTone self.INTtwo = INTtwo self.reference = 'CSGint' self.transform = tf.identity_matrix()
def __init__(self, transform=None): '''Transform is a 4x4 transformation matrix that rotates and translates the plane into the global frame (a plane in the xy plane point with normal along (+ve) z).''' super(Plane, self).__init__() self.transform = transform if self.transform == None: self.transform = tf.identity_matrix()
def rotation_matrix_from_vector_alignment(before, after): """ >>> # General input/output test >>> V1 = norm(np.random.random(3)) >>> V2 = norm([1,1,1]) >>> R = rotation_matrix_from_vector_alignment(V1, V2) >>> V3 = transform_direction(V1, R) >>> cmp_points(V2, V3) True >>> # Catch the special case in which we cannot take the cross product >>> V1 = [0,0,1] >>> V2 = [0,0,-1] >>> R = rotation_matrix_from_vector_alignment(V1, V2) >>> V3 = transform_direction(V1, R) >>> cmp_points(V2, V3) True """ # The angle between the vectors must not be 0 or 180 (i.e. so we can take a cross product) thedot = np.dot(before, after) if cmp_floats(thedot, 1.) == True: # Vectors are parallel return tf.identity_matrix() if cmp_floats(thedot, -1.) == True: # Vectors are anti-parallel print "Vectors are anti-parallel this might crash." axis = np.cross(before, after) # get the axis of rotation angle = np.arccos(np.dot(before, after)) # get the rotation angle return rotation_matrix(angle, axis)
def __init__(self, SUBplus, SUBminus): """ Definition {CSGsub} := {SUBplus}/{SUBminus} """ super(CSGsub, self).__init__() self.SUBplus = SUBplus self.SUBminus = SUBminus self.reference = 'CSGsub' self.transform = tf.identity_matrix()
def __init__(self, radius=1, length=1): super(Cylinder, self).__init__() self.radius = radius self.length = length self.transform = tf.identity_matrix()
def __init__(self, origin=(0,0,0), extent=(1,1,1)): super(Box, self).__init__() self.origin = np.array(origin) self.extent = np.array(extent) self.points = [origin, extent] self.transform = tf.identity_matrix()