コード例 #1
0
        /// <summary>
        /// Inspector (Cache mutator) - Creates a polar coordinates point on the surface of a unit-sphere from a qv coordinate and a circle radius.
        /// </summary>
        /// <param name="qv">QV Coordinates for a spherical circle. Q Range: [0- 4+) - representing the four quadrants - the decimal portion representing their angle; V Range [0, 1) - representing the distance from the center of the texture.</param>
        /// <param name="radius">The radius of the spherical circle. Range: [0, +PI].</param>
        /// <returns>The polar coordinates on the surface of a unit-sphere (relative to Quaternion.identity's forward).</returns>
        public static PolarCoordinates spherical_circle_to_polar(Vector2 qv, float radius)
        {
            float angle        = ((qv.x / 4) * (Mathf.PI * 2));
            float polar_radius = qv.y * radius;

            return(PolarCoordinates.polar(polar_radius, angle));
        }
コード例 #2
0
        /// <summary>
        /// Inspector (Cache mutator) - Creates a spherical circle QV (Quadrant-ValenceShell) coordinate set from a point on a unit sphere and a circle radius.
        /// </summary>
        /// <param name="polar">Polar coordinates on the surface of a unit-sphere (relative to Quaternion.identity's forward).</param>
        /// <param name="radius">The radius of the spherical circle. Range: [0, +PI].</param>
        /// <returns>QV Coordinates for a spherical circle. Q Range: [0, 4) - representing the four quadrants - the decimal portion representing their angle; V Range [0, 1+) - representing the distance from the center of the texture - or valence shell.</returns>
        public static SphericalCircleQVCoordinates polar_to_spherical_circle(PolarCoordinates polar, float radius)
        {
            float quadrant      = 4 * (polar.angle / (Mathf.PI * 2));
            float valence_shell = polar.radius / radius;

            return(new SphericalCircleQVCoordinates(new Vector2(quadrant, valence_shell), radius));
        }
コード例 #3
0
 public override Color32[] get_pixels(NormalizedCartesianCoordinates[] positions)
 {
     Color32[] colors = new Color32[positions.Length];
     for (int index = 0; index < positions.Length; ++index)
     {
         PolarCoordinates             polar            = positions[index];
         SphericalCircleQVCoordinates spherical_circle = polar.to_spherical_circle(radius_variable);
         if (!spherical_circle.valid())
         {
             colors[index] = new Color32(0, 0, 0, 0); // Color.clear
         }
         else
         {
             Vector2 texture_indices = spherical_circle.to_texture_coordinate(texture.width);
             colors[index] = texture.GetPixel((int)texture_indices.x, (int)texture_indices.y);
         }
     }
     return(colors);
 }