Exemplo n.º 1
0
 def intersect(self):
     intersections = []
     for u, v in list(self.mesh.edges()):
         a = self.mesh.vertex_attributes(u, 'xyz')
         b = self.mesh.vertex_attributes(v, 'xyz')
         x = intersection_segment_plane((a, b), self.plane)
         if not x:
             continue
         L_ax = length_vector(subtract_vectors(x, a))
         L_ab = length_vector(subtract_vectors(b, a))
         t = L_ax / L_ab
         key = self.mesh.split_edge(u, v, t=t, allow_boundary=True)
         intersections.append(key)
     self._intersections = intersections
Exemplo n.º 2
0
 def find_zero_crossing_point(self, u, v):
     """ Finds the position of the zero-crossing on the edge u,v. """
     a = self.mesh.vertex_attributes(u, 'xyz')
     b = self.mesh.vertex_attributes(v, 'xyz')
     plane = Plane(Point(0, 0, self.z), Vector(0, 0, 1))
     return intersection_segment_plane((a, b), plane)
Exemplo n.º 3
0
Rz = Rotation.from_axis_and_angle(Vector(0, 0, 1), radians(-50), plane.point)

T = Translation([3, 0, 0])

plane.transform(T * Rz * Ry)

# ==============================================================================
# Compute intersections
# ==============================================================================

intersections = []

for u, v in list(mesh.edges()):
    a = mesh.vertex_attributes(u, 'xyz')
    b = mesh.vertex_attributes(v, 'xyz')
    x = intersection_segment_plane((a, b), plane)
    if not x:
        continue
    L_ax = length_vector(subtract_vectors(x, a))
    L_ab = length_vector(subtract_vectors(b, a))
    t = L_ax / L_ab
    key = mesh.split_edge(u, v, t=t, allow_boundary=True)
    intersections.append(key)

# ==============================================================================
# Split faces
# ==============================================================================

if len(intersections) > 2:
    for fkey in list(mesh.faces()):
        split = [
Exemplo n.º 4
0
 def find_zero_crossing_data(self, u, v):
     """ Finds the position of the zero-crossing on the edge u,v. """
     a = self.mesh.vertex_attributes(u, 'xyz')
     b = self.mesh.vertex_attributes(v, 'xyz')
     return intersection_segment_plane((a, b), self.plane)