Testing Waters
  • Scrapbook
  • Projects
    • Bamiyan Cultural Center
    • Bauhaus Museum
    • Better Hebbal
    • Bicycle Station
    • Cross Laminated Timber
    • Facade
    • Flowing Fabrication
    • Form from Images
    • Guggenheim Helsinki
    • National War Museum
    • National War Memorial
    • Indflorescence
    • Rectangular Compartments
    • Retail Space Layout
    • Noise Barrier : Swedevia Airport
    • Walden
    • Wilson Garden
  • Patterns
    • Area Graph
    • Array along Curve
    • Fibbonacci and Factorial
    • Gyroid
    • Hexagonal Pattern From Image
    • Hexagonal Grid
    • Koch Star
    • Mandelbrot Set
    • Pattern
    • Pattern
    • Pattern
    • Phyllotaxis
    • Random Strip Widths
    • Skewed Surface
    • Staggered Checkerboard
    • Triangle subdivision
    • Vector Field
    • Voronoi
    • Waves
    • Weave
  • Geometry
    • Boundary Curve
    • Bridging parallel curves
    • British Museum Great Court
    • Catenary
    • Delete Adjacent
    • Geodesic Sphere
    • Group Branching Curves
    • Group Circles
    • Group curves
    • K Mean
    • Nurbs Surface Irregular
    • Overlapping Petals
    • Pair Nearest
    • Parametric Shapes
    • Platonic Solids
    • Polyline to PolyArc
    • Roman Surface
    • Sagrada Familia Schools Roof
    • Sine Curve
    • Sine Ribbon
    • Spherical Transformations
    • Split Rectangle
    • Tangential Circle through Point
    • Travelling Salesman Problem
    • Unaligned Bounding Box
  • Lists
    • Alter by Boolean Sequence
    • Color by distance
    • Consecutive Points
    • Distancing
    • Divide Equally
    • Geometry from Image
    • Image based Point Density
    • Isovists
    • Reduce Color Palette
    • Replace Consecutive
    • Replace Multiple
    • Replace Recurring
    • Shadow Area
    • Shortest Path
    • Solar Analysis
    • Topography Analysis
  • Motion
    • Adjacency
    • Animate Sphere
    • Cellular Automation
    • Cloth
    • Hypotrochoid
    • Manakin
    • Rolling Spiral
    • Tan Curve
    • Trammel of Archemedes
    • Image to Integer
  • Articles
    • A Conceptual Approach to Integrating Computational Methods in Early Stage Design
    • Design Script's ambiguous and versatile Replication Guides <1>
    • Design Script's ambiguous and versatile Replication Guides <2>
Powered by GitBook
On this page
  1. Motion

Adjacency

Space Adjacency

PreviousTopography AnalysisNextAnimate Sphere

Last updated 4 years ago

Adjacency - Linear

//Sorting into three lists
nSrt=List.Reverse(List.Sort(n));
nSbL=List.Chop(nSrt,3);
lst1=List.Transpose(List.TakeEveryNthItem(nSbL,2,-1));
lst2=List.Transpose(List.Reverse((List.TakeEveryNthItem(nSbL,2,0))<1>));

//Three sublists with the sum of numbers more or less the same
lst3=(List.Transpose([List.Shuffle(lst1<1>),List.Shuffle(lst2<1>)]));
lst4 = List.Flatten(List.Clean(lst3,false)<1>,-1);
r1=["Room1",ar1,ad1];
r2=["Room2",ar2,ad2];
r3=["Room3",ar3,ad3];
r4=["Room4",ar4,ad4];
r5=["Room5",ar5,ad5];
r6=["Room6",ar6,ad6];
r7=["Room7",ar7,ad7];
Rooms=[r1,r2,r3,r4,r5,r6,r7];
//Sorting List By Adjacency Factor
IndexSrtByAdj=SortIndexByValue(List.GetItemAtIndex(Rooms<1>,2));
RoomsSrtByAdj=List.GetItemAtIndex(Rooms,IndexSrtByAdj);

//Circles
Circles=AdjL(List.GetItemAtIndex(RoomsSrtByAdj<1>,1));
Rms=Circles.ExtrudeAsSolid(Vector.ZAxis(),1);
Clr1=Color.ByARGB(255,255,0,0);
Clr2=Color.ByARGB(255,0,255,0);
Clr3=Color.ByARGB(255,0,0,255);
Clrs=[Clr1,Clr2,Clr3];
ClrI=0..1;
ClrV=0..1..#(List.Count(Rms));

Adjacency - Pairs

def AdjM(RmAr:var[])
{
return=[Imperative]
{
k=0;
rd=[];
cp=[];
ci=[];
dis=[];
cpd=[];
cpl=[];
cph=[];
cpx=[];
cpy=[];

for (i in RmAr)
{
	if (k<2)
	{
		rd[k]=Math.Sqrt(i/Math.PI);
		cp[0]=Point.Origin();
		cp[k]=Point.ByCoordinates(rd[k]+rd[0],0);
		ci[0]=Circle.ByCenterPointRadius(cp[0],rd[0]);
		ci[k]=Circle.ByCenterPointRadius(cp[k],rd[k]);
		k=k+1;
	}
	else
	{
		rd[k]=Math.Sqrt(i/Math.PI);
		dis[k]=rd[k-2]+rd[k-1];
		cpd[k]=Math.Sqrt(Math.Pow((cp[k-2].X-cp[k-1].X),2)+Math.Pow((cp[k-2].Y-cp[k-1].Y),2));
		cpl[k]=(Math.Pow(rd[k-2]+rd[k],2)-Math.Pow(rd[k-1]+rd[k],2)+Math.Pow(cpd[k],2))/(cpd[k]*2);
		cph[k]=Math.Sqrt(Math.Pow(rd[k-2]+rd[k],2)-Math.Pow(cpl[k],2));
		cpx1[k]=(cpl[k]*(cp[k-1].X-cp[k-2].X)/cpd[k])+(cph[k]*(cp[k-1].Y-cp[k-2].Y)/cpd[k])+cp[k-2].X;
		cpx2[k]=(cpl[k]*(cp[k-1].X-cp[k-2].X)/cpd[k])-(cph[k]*(cp[k-1].Y-cp[k-2].Y)/cpd[k])+cp[k-2].X;
		cpy1[k]=(cpl[k]*(cp[k-1].Y-cp[k-2].Y)/cpd[k])-(cph[k]*(cp[k-1].X-cp[k-2].X)/cpd[k])+cp[k-2].Y;
		cpy2[k]=(cpl[k]*(cp[k-1].Y-cp[k-2].Y)/cpd[k])+(cph[k]*(cp[k-1].X-cp[k-2].X)/cpd[k])+cp[k-2].Y;
		if (cpy1[k]>=cpy2[k])
		{
		cpx[k]=cpx1[k];
		cpy[k]=cpy1[k];
		}
		else
		{
		cpx[k]=cpx2[k];
		cpy[k]=cpy2[k];
		}
		cp[k]=Point.ByCoordinates(cpx[k],cpy[k]);
		ci[k]=Circle.ByCenterPointRadius(cp[k],rd[k]);
		k=k+1;
	}
}
return=ci;
}
};
r1=["Room1",ar1,ad1];
r2=["Room2",ar2,ad2];
r3=["Room3",ar3,ad3];
r4=["Room4",ar4,ad4];
r5=["Room5",ar5,ad5];
r6=["Room6",ar6,ad6];
r7=["Room7",ar7,ad7];
Rooms=[r1,r2,r3,r4,r5,r6,r7];
//Sorting List By Adjacency Factor
IndexSrtByAdj=List.SortIndexByValue(List.GetItemAtIndex(Rooms<1>,2));
RoomsSrtByAdj=List.GetItemAtIndex(Rooms,IndexSrtByAdj);

//Circles
Circles=AdjM(List.GetItemAtIndex(RoomsSrtByAdj<1>,1));
Rms=Circles.ExtrudeAsSolid(Vector.ZAxis(),1);
clrR=Math.RemapRange(Math.RandomList(List.Count(Rms)),0,200);
clrG=Math.RemapRange(Math.RandomList(List.Count(Rms)),0,200);
clrB=Math.RemapRange(Math.RandomList(List.Count(Rms)),0,200);
Clrs=Color.ByARGB(255,clrR,clrG,clrB);
ClrI=0..1..#(List.Count(Rms));
ClrV=Math.RemapRange(List.GetItemAtIndex(RoomsSrtByAdj<1>,2),0,1);
6KB
AdjacencyL.zip
archive
6KB
AdjacencyM.zip
archive