-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccess_areas.py
More file actions
executable file
·49 lines (40 loc) · 1.22 KB
/
access_areas.py
File metadata and controls
executable file
·49 lines (40 loc) · 1.22 KB
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
import Rhino
"""
has_thoroughfare
billboard_distances
busstop_distances
bikeway_distances
trails_distances
access_distances
access_edges
"""
#points # a list of the hardscape points
test_val = 30
nears, nearPoints = zip(*[(i, points[i]) for i in range(len(points)) if access_distances[i] < access_filter_distance])
gridcloud = Rhino.Geometry.PointCloud(nearPoints)
def compareCloud(i): # point cloudss match input list index!
item = gridcloud[i]
pt = Rhino.Geometry.Point3d(item.X, item.Y, item.Z)
return pt.DistanceTo( nearPoints[i] )
def closestCurve(curves, point, limit=1000):
closest_distance = limit
closest_curve = None
for i, curve in enumerate(curves):
out = curve.ClosestPoint( point, limit )
if len(out) > 1:
if out[0]:
t = out[1]
else:
t = None
if t:
pt = curve.PointAt(t)
dist = pt.DistanceTo(point)
if dist < closest_distance:
closest_distance = dist
closest_curve = i
if closest_curve != None:
return closest_curve
else:
return -1
closests = [closestCurve(access_edges, p, access_filter_distance) for p in nearPoints]
a = closests