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. Lists

Geometry from Image

PreviousDivide EquallyNextImage based Point Density

Last updated 4 years ago

pntSeq(grpPnts(pts));

	// Group Contiguous Points
	def grpPnts(pts:var[]..[])
    {
    	dis1 = pts<1>.DistanceTo(pts<2>)<2;
    	ind1 = List.AllIndicesOf(dis1<1>,true);
    	bln1 = true;
    	ind2 = [Imperative]
    	{
    		while (bln1)
    		{
    			cnt1 = List.Count(ind1);
    			ind1 = grpIndx(ind1);
    			cnt2 = List.Count(ind1);
    			bln1 = cnt2!=cnt1;
    		}
    		return = ind1;
    	}
    	pts1 = List.GetItemAtIndex(pts,ind2);
    	return = pts1;
    };

    def grpIndx(ind:var[]..[])
    {
    	ind1 = List.SetIntersection(ind<1>,ind<2>);
    	cnt1 = List.Count(ind1<1><2>)>0;
    	ind2 = List.FilterByBoolMask(ind,cnt1<1>)["in"];
    	ind3 = List.UniqueItems(List.Flatten(ind2<1>,-1)<1>);
    	ind4 = List.UniqueItems(List.Sort(ind3<1>));
    	return = ind4;
    };

    def pntSeq(pnt:var[]..[])
	{
		c = Point.ByCoordinates(Math.Sum(pnt.X)/List.Count(pnt<1>),
		Math.Sum(pnt.Y)/List.Count(pnt<1>));
		a = (Vector.ByTwoPoints(c,pnt).Normalized()).AngleAboutAxis
		(Vector.XAxis(),Vector.ZAxis());
		p = List.SortByKey(pnt<1>,a<1>)["sorted list"];
		return p;

	};
7KB
imgTrace.zip
archive