Rhinoscript, point cloud

Bookmark and Share

This codes, generate 11 random points around to selected point. change the values of the scope to and the number of iterations to control the densities.

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
Option Explicit
'carlos de la barrera, julio 2007, generador un punto aleatorio entorno a otro punto.

Call Points()
Sub Points()
 
	Dim puntoCordenada, arrPoint, i, punto
 
	puntoCordenada = Rhino.GetObject("selecciona punto coordenada", 1)
	If IsNull(puntoCordenada) Then Exit Sub
 
	arrPoint = Rhino.PointCoordinates(puntoCordenada)                  
 
	Dim scope : scope = 10
	Dim minX, maxX, minY, maxY, minZ, maxZ
	Dim x, y, z
 
	Randomize
 
	For i = 0 To 10
 
		minX = arrPoint(0) - scope
		maxX = arrPoint(0) + scope
		minY = arrPoint(1) - scope
		maxY = arrPoint(1) + scope
		minZ = arrPoint(2) - scope
		maxZ = arrPoint(2) + scope
 
		x = minX + Rnd() * (maxX - minX)
		y = minY + Rnd() * (maxY - minY)
		z = minZ + Rnd() * (maxZ - minZ)
 
		Call Rhino.AddPoint(Array(x, y, z))                                      
	Next
 
End Sub

Leave a Reply