-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlist_utils.py
59 lines (40 loc) · 1.65 KB
/
list_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from utils import *
def cone(start_dia, end_dia, start_center, end_center, number_of_section):
delta = (end_center-start_center) * (1/ (number_of_section-1))
centers = points_list_delta(number_of_section, start_center, delta);
normals = points_list_const(number_of_section, geometry.CTiglPoint(1,0,0) )
delta_h = (end_dia - start_dia)/(number_of_section-1)
heights = double_list_delta(number_of_section, start_dia, delta_h)
delta_w = (end_dia - start_dia)/(number_of_section-1)
widths = double_list_delta(number_of_section, start_dia, delta_w)
return [centers, normals, heights, widths];
def points_list_const(number_of_points, init_point = geometry.CTiglPoint(0,0,0)):
l = []
for i in range(0, number_of_points):
l.append(init_point);
return l
def points_list_delta(number_of_points, start_point = geometry.CTiglPoint(0,0,0), delta = geometry.CTiglPoint(1,0,0) ):
l = []
temp = start_point;
for i in range(0, number_of_points):
l.append(temp);
temp = temp + delta;
return l
def double_list_const(number_of_points, init_double = 1.0):
l = []
for i in range(0, number_of_points):
l.append(init_double);
return l
def double_list_delta(number_of_points, strat_d, delta_d):
l = []
for i in range(0, number_of_points):
l.append(strat_d + (i * delta_d ));
return l
def extend_lists(lists_to_extend, list_to_add):
# need to be the same length
c = 0;
for l in lists_to_extend:
l.extend(list_to_add[c])
c = c+1
def get_last_center(parameters):
return parameters[0][len(parameters[0])-1]