Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def super_triangle(coords):
centpt = centroid_points(coords)
bbpts = bounding_box(coords)
dis = distance_point_point(bbpts[0], bbpts[2])
dis = dis * 300
v1 = (0 * dis, 2 * dis, 0)
v2 = (1.73205 * dis, -1.0000000000001 * dis, 0) # due to numerical issues
v3 = (-1.73205 * dis, -1 * dis, 0)
pt1 = add_vectors(centpt, v1)
pt2 = add_vectors(centpt, v2)
pt3 = add_vectors(centpt, v3)
return pt1, pt2, pt3
def super_triangle(coords):
centpt = centroid_points(coords)
bbpts = bounding_box(coords)
dis = distance_point_point(bbpts[0], bbpts[2])
dis = dis * 300
v1 = (0 * dis, 2 * dis, 0)
v2 = (1.73205 * dis, -1.0000000000001 * dis, 0) # due to numerical issues
v3 = (-1.73205 * dis, -1 * dis, 0)
pt1 = add_vectors(centpt, v1)
pt2 = add_vectors(centpt, v2)
pt3 = add_vectors(centpt, v3)
return pt1, pt2, pt3
def super_triangle(coords):
centpt = centroid_points(coords)
bbpts = bounding_box(coords)
dis = distance_point_point(bbpts[0], bbpts[2])
dis = dis * 300
v1 = (0 * dis, 2 * dis, 0)
v2 = (1.73205 * dis, -1.0000000000001 * dis, 0) # due to numerical issues
v3 = (-1.73205 * dis, -1 * dis, 0)
pt1 = add_vectors(centpt, v1)
pt2 = add_vectors(centpt, v2)
pt3 = add_vectors(centpt, v3)
return pt1, pt2, pt3
def super_triangle(coords):
centpt = centroid_points(coords)
bbpts = bounding_box(coords)
dis = distance_point_point(bbpts[0], bbpts[2])
dis = dis * 300
v1 = (0 * dis, 2 * dis, 0)
v2 = (1.73205 * dis, -1.0000000000001 * dis, 0) # due to numerical issues
v3 = (-1.73205 * dis, -1 * dis, 0)
pt1 = add_vectors(centpt, v1)
pt2 = add_vectors(centpt, v2)
pt3 = add_vectors(centpt, v3)
return pt1, pt2, pt3
print(line_offset)
"""
a, b = line
ab = subtract_vectors(b, a)
direction = normalize_vector(cross_vectors(normal, ab))
if not is_item_iterable(distance):
distance = [distance]
distances = list(iterable_like(line, distance, distance[-1], as_single=False))
u = scale_vector(direction, distances[0])
v = scale_vector(direction, distances[1])
c = add_vectors(a, u)
d = add_vectors(b, v)
return c, d
line_offset = offset_line(line, distance)
print(line_offset)
"""
a, b = line
ab = subtract_vectors(b, a)
direction = normalize_vector(cross_vectors(normal, ab))
if not is_item_iterable(distance):
distance = [distance]
distances = list(iterable_like(line, distance, distance[-1], as_single=False))
u = scale_vector(direction, distances[0])
v = scale_vector(direction, distances[1])
c = add_vectors(a, u)
d = add_vectors(b, v)
return c, d
line_offset = offset_line(line, distance)
print(line_offset)
"""
a, b = line
ab = subtract_vectors(b, a)
direction = normalize_vector(cross_vectors(normal, ab))
if not is_item_iterable(distance):
distance = [distance]
distances = list(iterable_like(line, distance, distance[-1]))
u = scale_vector(direction, distances[0])
v = scale_vector(direction, distances[1])
c = add_vectors(a, u)
d = add_vectors(b, v)
return c, d
def super_triangle(coords):
centpt = centroid_points(coords)
bbpts = bounding_box(coords)
dis = distance_point_point(bbpts[0], bbpts[2])
dis = dis * 300
v1 = (0 * dis, 2 * dis, 0)
v2 = (1.73205 * dis, -1.0000000000001 * dis, 0) # due to numerical issues
v3 = (-1.73205 * dis, -1 * dis, 0)
pt1 = add_vectors(centpt, v1)
pt2 = add_vectors(centpt, v2)
pt3 = add_vectors(centpt, v3)
return pt1, pt2, pt3
def get_vertices_coordinates(self):
xyzs = [vertex.co for vertex in self.geometry.vertices]
return {vertex: add_vectors(self.location, xyz) for vertex, xyz in enumerate(xyzs)}