Grasshopper Tutorial 06 | Domain Basics

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right in this video I would like to show you how to work with domains a little bit more and towards the end I'm also going to show you how to use the gradient input as well as a custom preview now we've already encountered domain commands when we were using ranges so just to repeat if I've got a range what it takes is a domain which gives it a start and an end point and then a number of steps into which to divide this domain so if I now put a panel at the end of this you can see that by default it divides the event domain from 0 to 1 in 10 steps so we get 11 values at the end now if we want to change this we can construct a domain and by default this also goes from 0 to 1 but we can change this I'm going to put in two sliders here let's have one that goes from 12 and another one goes to 24 there we go now you can see that we're dividing the space between 12 and 24 in 10 steps and remember we can also have the start be higher than the end so let's say we go from let's say 50 or 48 in this case to a hundred then sorry we're going from a hundred to 48 of course so it starts at hundred and then ends at 48 and between that it's supplied it in to 10 or we can also of course change that and now it's going to give us 21 items because it's doing it in 20 steps and we use this range command to construct points and that's exactly what I want to do now as well so construct points and I'm actually going to change the main from 0 to 100 and ten steps as per default I'm going to plug this into X and Y and now if you recall if we graphed one of these two inputs we will actually get a grid like this and I'm actually going to then if you look at it here you can see that we've then got all these lists of lists with our points in it and I'm actually going to flatten that to get a single list now why do I do that well I want to build an attractor map with you guys so attractor map means that I'm going to use these points as a center point of circles and then I'm going to change the radius of the circle depending upon the distance of the point to align that I'm going to draw through this grid so depending on the distance of each point to that line the circle around that point is going to have a different radius so next step is of course to start drawing circles and if we use a point and plug it into this plane by default it will take the world XY plane and position that on top of that point and if we zoom in you can see that we've now got a circle at each of these points but the radius is not changing and it's also set to one now if we change this say to ten we get overlapping circles and as we decrease it we get smaller and smaller circles right okay so how do we go about getting the distance from this curve to these points well first of all we need to input this curve into whoopsie-daisy wrong command here we go curve set one curve select our curve and we've done and from these points we are going to use the curve closest point command because that not only determines the closest point on that curve but it also gives us the distance so if I now plug in this curve and this list of points you can see that we get the closest point and out here we get our distance I'm going to put this in a panel and here we go now if we plug in these distances which are going on all the way to 70 and so forth the circles we get will look like this so we've got lots of overlapping circles and that's not exactly what we wanted we want to control the minimum and maximum dimension of those circles and for that we're going to use domains now if you go to the domain block you will see several commands and one of those commands is bound and this actually lets us determine what the smallest and largest number in one of our lists is so if we look at the output of those bounds it's outputting a domain and a domain always consists of a start and an end now if we want to get at those values individually we need to deconstruct this domain so deconstruct domain and make sure to select one dimensional domain because we're not working with two dimensional domains here and if we then plug this in we get a start right zero point four two four two seven and an end 71 point four five six and so forth now as you can now tell these circles have got radii going from zero point four two all the way to 71 something what we want to have is something let's say circles going from five to twelve so we now need to construct a domain and then map one domain to the other so I'm going to go construct domain and let's get rid of this panel so our start is going to be at say five and the end is going to be at twelve all right so this is a domain that we want to map to and this is the main the domain from which we're starting so what we now need is a remap numbers block and this takes three inputs it takes the values that are supposed to be remapped in this case this is our distances it takes a source domain and the source domain is of course the domain of those distances so it goes from - 0.4 to 271 and now we're going to remap all of those distances to a target domain which we said is 5 to 12 and if we now plug these in we actually get something a little bit more sensible so I'm going to hide a few components of that we can see a little bit better side there and hide our curve and our closest points so now we've got a curve and we've got our circles and the ones closest to the curve have got a small radius and the ones far away I've got a large radius and we can now play with these values so I'm going to decrease it a little bit here and also at the end so that we don't get an overlap I think it may be even smaller and because those whole numbers aren't really giving me enough control I'm going to change both of these sliders to real numbers and for even finer control what you can do when you're moving a slider you can actually hold control key and then it moves you get a finer control of that slider so let's go all the way to there so what's happened if you look at our original distances they were going from 0.4 to 271 now we've taken all of these numbers and remap them to a domain that starts at one point nine eight four and goes all the way to four point eight so if we look at what's coming out of this remap block you can see that there's six point one two turn into a two point two one it's three point two eight turn into a two point zero nine seven and so forth and once again we can actually flip the start in the end so let's say we want to have the big circles in the middle and then smaller circles at the edge we can just flip those two inputs there we go so that's the remap domain command we know how to get the bounds of a domain and how to split those into a start and an end now with these circles I would like to go a step further let's get rid of these panels and actually I'm going to fill these circles with a surface I'm going to use a boundary surface now we've got filled circles in a sense because we've got a surface inside of each one I'm going to hide the actual circles and now I'm going to colorize them and we can do that if we go to the where is it display and we've got preview custom preview now a custom preview takes two inputs and you can see that actually doesn't produce anything it only changes things in the run of you port takes a geometry our surfaces so I can now actually hide these surfaces and only use the custom preview once and then it takes a shader and you can get really fancy with creating custom materials but we are simply going to use a gradient of color and that's an input block and so right now we've got a gradient going from pink to red and if I plug this in nothing will happen because we've got no inputs here so I'm going to disconnect this again come on there we go now what does this gradient take as inputs it takes a lower limit and an upper limit of that gradient range and then points within that range determine where along our gradient the color is going to be so if I simply take our original distances and then plug in the gradient nearly all the colors will be the same because only very few values will actually be under under one so what we actually need to do is we could use our remap numbers but then the domain still wouldn't be going from 0 to 1 so what we can do is we can change the lower limit and the upper limit and to do that we're going to deconstruct this original distance domain and we've already done that here with our start and end so let's move this down here and I'm going to use the start so the lower bound of our distances that's the lower bound for the gradient and the end so the upper bound of our distances as the upper bound of the gradient and I can see that we actually have a gradient of color that changes with the changing radius of that of those circles now as always there's also a different way to do this so instead of change the changing these lower and upper bounds we could actually the distances again only this time to zero and one so I'm going to get rid of this and use another remap command and construct myself a domain which goes from zero to one which it does by default so I can just plug this into our target the source domain is still our distances and the values are the distances themselves and out comes a set of numbers let's look at it in the panel I go from zero to one I'm going to plug these in to here and you can see that it still works now we could also once again flip things so if I want to have say the the pink out the edges and the red in the middle what I could do is I could change these to domain so I'm going to go one here so that it starts at one and ends at zero and now we've got the red in the middle and the pink at the edges that's not the only color gradient uhyou can to find your own gradients but there's also a bunch of presets which you can use like black and white or the classic jet color alright so that's how you can use domains showing you how to determine what the bounds of a domain are how to get at the start and the end of that domain and how to remap one domain onto another thank you for watching
Info
Channel: Individualized Production in Architecture
Views: 73,053
Rating: 4.979424 out of 5
Keywords: Grasshopper, RWTH
Id: MczAAbvvdiw
Channel Id: undefined
Length: 15min 9sec (909 seconds)
Published: Tue Nov 29 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.