Archive for July, 2009

Jul
22

Attracted Flows

4a

3a

This is a rhinoscript where you can set various points where vectors flow out from according to a certain velocity. As these vectors travel, the flows are attracted to the various attractor points in different weights three dimensionally. It simulates a close logic to the emitted particles being attracted to newton forces in Maya.

1

2

—-

Option Explicit
‘Script written by Howard Jiho Kim / crtl-i.com
Call Main()
Sub Main()
Dim startPt, velocity
velocity = Array(10,0,0)
startPt = Rhino.GetObjects(“Select Start Points”,1)
‘Attractors / Distances
Dim no_attr, attr, attrStr, i
no_attr = Rhino.GetInteger(“How many attractors?”)
ReDim attr(no_attr-1), attrStr(no_attr-1)
For i=0 To no_attr-1
attr(i) = Rhino.GetObject(“Select Attractor ” & (i+1),1)
attrStr(i) = Rhino.GetReal(“Enter Strength for Attractor ” & (i+1))
Next
For i=0 To Ubound(startPt)
Flow velocity, startPt(i), no_attr, attr, attrStr, 35
Next
End Sub
Function Flow(velocity, startPt, no_attr, attr, attrStr, gens)
Dim vec1, vec0
vec1 = Rhino.VectorCreate(velocity, Array(0,0,0))
vec0 = Rhino.VectorCreate(Rhino.PointCoordinates(startPt), Array(0,0,0))
Dim totalDistance, distance, i
ReDim distance(no_attr-1)
Dim vec, finalVec, vec4, tagStop
tagStop = 0
ReDim vec(no_attr-1)
Dim newPt, newLine, endPt2
totalDistance=0
If gens>0 Then
For i=0 To no_attr-1
distance(i) = Rhino.Distance(Rhino.PointCoordinates(startPt), Rhino.PointCoordinates(attr(i)))
totalDistance = totalDistance + distance(i)
Rhino.Print distance(i)
Rhino.Print totalDistance
If distance(i) < 1 Then
gens = -1
End If
Next
‘Vectors
vec4 = vec1
For i=0 To no_attr-1
vec(i) = Rhino.VectorCreate(Rhino.PointCoordinates(attr(i)), Rhino.PointCoordinates(startPt))
vec(i) = Rhino.VectorUnitize(vec(i))
vec(i) = Rhino.VectorScale(vec(i), (attrStr(i)/distance(i))^2)
vec4 = Rhino.VectorAdd(vec4, vec(i))
Next
finalVec = Rhino.VectorUnitize(vec4)
finalVec = Rhino.VectorScale(finalVec, 1)
If tagStop = 0 Then
newPt = Rhino.AddPoint(finalVec)
newLine = Rhino.AddLine(Array(0,0,0), finalVec)
endPt2 = Rhino.MoveObject(newPt, vec0)
newLine = Rhino.MoveObject(newLine, vec0)
End If
Flow velocity, endPt2, no_attr, attr, attrStr, gens-1
End If
End Function

Option Explicit

‘Script written by Howard Jiho Kim / crtl-i.com

Call Main()

Sub Main()

Dim startPt, velocity

velocity = Array(10,0,0)

startPt = Rhino.GetObjects(“Select Start Points”,1)

‘Attractors / Distances

Dim no_attr, attr, attrStr, i

no_attr = Rhino.GetInteger(“How many attractors?”)

ReDim attr(no_attr-1), attrStr(no_attr-1)

For i=0 To no_attr-1

attr(i) = Rhino.GetObject(“Select Attractor ” & (i+1),1)

attrStr(i) = Rhino.GetReal(“Enter Strength for Attractor ” & (i+1))

Next

For i=0 To Ubound(startPt)

Flow velocity, startPt(i), no_attr, attr, attrStr, 35

Next

End Sub

Function Flow(velocity, startPt, no_attr, attr, attrStr, gens)

Dim vec1, vec0

vec1 = Rhino.VectorCreate(velocity, Array(0,0,0))

vec0 = Rhino.VectorCreate(Rhino.PointCoordinates(startPt), Array(0,0,0))

Dim totalDistance, distance, i

ReDim distance(no_attr-1)

Dim vec, finalVec, vec4, tagStop

tagStop = 0

ReDim vec(no_attr-1)

Dim newPt, newLine, endPt2

totalDistance=0

If gens>0 Then

For i=0 To no_attr-1

distance(i) = Rhino.Distance(Rhino.PointCoordinates(startPt), Rhino.PointCoordinates(attr(i)))

totalDistance = totalDistance + distance(i)

Rhino.Print distance(i)

Rhino.Print totalDistance

If distance(i) < 1 Then

gens = -1

End If

Next

‘Vectors

vec4 = vec1

For i=0 To no_attr-1

vec(i) = Rhino.VectorCreate(Rhino.PointCoordinates(attr(i)), Rhino.PointCoordinates(startPt))

vec(i) = Rhino.VectorUnitize(vec(i))

vec(i) = Rhino.VectorScale(vec(i), (attrStr(i)/distance(i))^2)

vec4 = Rhino.VectorAdd(vec4, vec(i))

Next

finalVec = Rhino.VectorUnitize(vec4)

finalVec = Rhino.VectorScale(finalVec, 1)

If tagStop = 0 Then

newPt = Rhino.AddPoint(finalVec)

newLine = Rhino.AddLine(Array(0,0,0), finalVec)

endPt2 = Rhino.MoveObject(newPt, vec0)

newLine = Rhino.MoveObject(newLine, vec0)

End If

Flow velocity, endPt2, no_attr, attr, attrStr, gens-1

End If

End Function

Jul
06

Facade Studies

Some facade studies. All these patterns are made through a version of script that is very close to the 3D-pixelate code.

090706_type_f

1

3

4