This topic provides a reference table for all automatic type conversions to complex number, sorted by merit.
Direct Conversions
This section lists all direct
conversions to the complex number 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 |
|---|---|
| integer | Converts the integer to a complex number with no imaginary component. |
| integer (big) | Converts the integer to a complex number with no imaginary component. |
| number | Converts the number to a complex number with no imaginary component. |
| point2 | Maps X and Y coordinates to real and imaginary values. |
| point3 | Maps X and Y coordinates to real and imaginary values. |
| vector | Maps X and Y components to real and imaginary values. |
Fair Conversions
This section lists all fair
conversions to the complex number 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 to a complex number with matching phase and magnitude one. |
| boolean | Converts false to 0+0i, true to 1+0i. |
| interval | Converts the interval length to a complex number with no imaginary component. |
Strange Conversions
This section lists all strange
conversions to the complex number 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 |
|---|---|
| colour | Maps luminance and hue to the complex plane. |
| Colour (RGB) | Maps luminance and hue to the complex plane. |