Grasshopper: Visual Scripting for Rhinoceros 3D. David Bachman

Чтение книги онлайн.

Читать онлайн книгу Grasshopper: Visual Scripting for Rhinoceros 3D - David Bachman страница 10

Автор:
Жанр:
Серия:
Издательство:
Grasshopper: Visual Scripting for Rhinoceros 3D - David Bachman

Скачать книгу

target="_blank" rel="nofollow" href="#fb3_img_img_844820eb-91e0-5279-b6b0-6fa7d4273a52.jpg" alt="img"/>

      To remedy this we have added more to the script to test whether or not each point is inside the curve, and to do something to change it if it is. The Point In Curve component (Curve tab, Analysis panel) is what performs the test. This component will output a 0 for each point that is inside the curve, and a 2 for those points that are outside. By feeding this to the A input of an Equality component (Math tab, Operators panel), with the B input set to 0, we get a list of true/false values.

      The true/false values are now sent to the P input of a Dispatch component, with the L input receiving the list of unit normal vectors. The Dispatch component will now separate the list of unit normal vectors into two separate lists, depending on whether the point obtained earlier was inside the curve or outside. For those points that are outside the curve we do nothing. For points inside the curve we negate the vector with a Negative component (Math tab, Operators panel), flipping its direction.

      Finally, all of the vectors have to be re-assembled into one list again. The important part is that they must end up in the same order that they started. This is precisely what the Weave component will do when we send the list of true/false values obtained earlier to the P input. Adding these modified unit normal vectors to the curve points now produces a set of points that are all on the outside of the curve. The final step is to create an interpolated curve through these points with an Interpolate component (Curve tab, Spline panel). The result is depicted in Figure 6.6.

img

      Grasshopper has no native mechanism for creating loops, although there are multiple plug-ins that add this functionality. At first glance, this may seem to eliminate the possibility of recursive definitions. To some extent this is true, but many recursive operations can be accomplished through list shifting. In the next example, shown in Figure 6.7, we present a script that begins with a list of points, and creates lines connecting each point to its predecessor in the list, a simple kind of recursion.

      Конец ознакомительного фрагмента.

      Текст предоставлен ООО «ЛитРес».

      Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.

      Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.

/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAUAA08DASIA AhEBAxEB/8QAHwAAAQMFAQEBAAAAAAAAAAAAAAYHCAMEBQkKAQIL/8QAkBAAAQQBAgQDBAMKBgcM DgE1AQIDBQYEBxEACBIhExUxCRQWQSJRYRcjJCUycYGRofAKJjQ1scEzNkJF0eHxGENERlJUVVZm dHa1GSc3ODlTYmRlcnV3lJWytihXY3N4goSFhpKWt9IaOlh5l5iipaaztMLW1ylHSGenxdPU4llo g4eTo6S4xtXl8sPE5vX/xAAeAQABBAMBAQEAAAAAAAAAAAAAAwQFBgECBwgJCv/EAFoRAAECBAUB BQUEBwYEAgYEDwECEQADBCEFBhIxQVEHFCJh

Скачать книгу