This topic provides a reference table for all automatic type conversions to integer, sorted by merit.
Direct Conversions
This section lists all direct
conversions to the integer type. A 'Direct' conversion indicates a relation between very related types, such as integers and numbers, or 2D and 3D points. Though note that even these conversions can fail due to out-of-bounds issues, or be narrowing due to reduction.
| From | Explanation |
|---|---|
| complex number | Extracts and rounds the real component of a complex number. |
| integer (big) | Converts the big integer to a standard, 32-bit integer. |
| number | Rounds the decimal number to an integer. |
Fair Conversions
This section lists all fair
conversions to the integer type. A 'Fair' conversion indicates the types involved are closesly related in a data layout sense, though not necessarily in a conceptual sense. For example booleans and integers, or points and vectors. Although these conversions may fail or narrow, it is nevertheless considered decent practice to rely upon them in algorithms.
| From | Explanation |
|---|---|
| angle | Converts the angle value to a integral number of degrees. |
| arc | Measures and rounds the length of the arc. |
| boolean | Converts false to zero, true to one. |
| box | Measures and rounds the area of the box. |
| brep | Measures and rounds the area of the brep. |
| circle | Measures and rounds the circumference of the circle. |
| curve | Measures and rounds the length of the curve. |
| interval | Measures and rounds the length of the interval. |
| line | Measures and rounds the length of the line. |
| mesh | Measures and rounds the area of the mesh. |
| polyline | Measures and rounds the length of the polyline. |
| rectangle | Measures and rounds the perimeter of the polyline. |
| sphere | Measures and rounds the area of the sphere. |
| SubD | Measures and rounds the area of the SubD. |
| surface | Measures and rounds the area of the surface. |
| tree path | Measures the number of elements in the path. |
| triangle | Measures and rounds the perimeter of the triangle. |
| tube | Measures and rounds the area of the tube. |
| vector | Measures and rounds the length of the vector. |
Plausible Conversions
This section lists all plausible
conversions to the integer type. A 'Plausible' conversion indicates a non-straightforward, but a still reasonable conversion between two types that share a salient quality, or where one is an obvious sub-type of the other. For example curves and intervals, or points and planes. Any plausible conversion can also be achieved through the explicit use of standard components.
| From | Explanation |
|---|---|
| colour | Measures the luminance value as an integer. |
| Colour (RGB) | Measures the luminance value as an integer. |
Strange Conversions
This section lists all strange
conversions to the integer type. A 'Strange' conversion indicates a peculiar, but occasionally sensible, translation between types. However, it is equally likely that the conversion was not intended and thus represents a mistake in the algorithm design, which is why this conversion level is the default for showing conversion warnings in the Grasshopper interface. Examples in this category include the conversion between colours and booleans, or between circles and triangles. Any strange conversion can also be achieved through the explicit use of standard components.
| From | Explanation |
|---|---|
| point2 | Measures and rounds the distance from the point to origin. |
| point3 | Measures and rounds the distance from the point to origin. |
Weird Conversions
This section lists all weird
conversions to the integer type. A 'Weird' conversion indicates an exotic relationship between types which is almost certainly unintended on the part of the user. However, very occasionally these conversions make sense and allow the user to avoid the use of several components to achieve the same result. Examples in this category include conversions between planes and integers, or points and intervals.
| From | Explanation |
|---|---|
| plane | Measures and rounds the distance from world origin to the plane origin. |