Calculate the x,y coordinate of a given angle at a given distance from the center

0 Degree is 3 o'clock

@param float $radius
@param float $angleInDegrees

@return array
18175
protected function polarToCartesian($radius, $angleInDegrees)
    {
        $angleInRadians = $angleInDegrees * M_PI / 180.0;

        return array(
            $this->size / 2 + ($radius * cos($angleInRadians)),
            $this->size / 2 + ($radius * sin($angleInRadians)),
        );
    }
238847
public static function calculateDistance(float $sourceLatitude, float $sourceLongitude, float $targetLatitude, float $targetLongitude) : float
    {
        $radSourceLat = deg2rad($sourceLatitude);
        $radSourceLon = deg2rad($sourceLongitude);
        $radTargetLat = deg2rad($targetLatitude);
        $radTargetLon = deg2rad($targetLongitude);

        $latitudeDelta = $radTargetLat - $radSourceLat;
        $longitudeDelta = $radTargetLon - $radSourceLon;

        $angle = 2 * asin(
                sqrt(
                    pow(sin($latitudeDelta / 2), 2) +
                    cos($radSourceLat) * cos($radTargetLat) * pow(sin($longitudeDelta / 2), 2)
                )
            );

        return $angle * Geo::EARTH_RADIUS_METERS;
    }
1092290
function (radians) {
            var angle = radians % this.TWO_PI;

            return angle > Math.PI ? angle - this.TWO_PI : angle < -Math.PI ? this.TWO_PI + angle : angle;
        }
281373
def rodrigues_axis_angle_rotate(x, vec, theta):
    
    x = np.array(x).T
    vec = np.array(vec).T
    theta = np.array(theta).T[...,None]

    out = np.cos(theta)*x + np.sin(theta)*np.cross(vec, x) + \
        (1 - np.cos(theta)) * (vec * x).sum(axis=-1)[...,None] * vec

    return out.T
658842
function (angle, radius) {
		
		var chart = this.chart,
			center = this.center;
			
		angle = this.startAngleRad + angle;

		return {
			x: chart.plotLeft + center[0] + Math.cos(angle) * radius,
			y: chart.plotTop + center[1] + Math.sin(angle) * radius
		}; 
		
	}
732067
public static int[] imageOffsets(double radius, int imgWidth) {


		double PI2 = Math.PI * 2.0;

		double circumference = PI2 * radius;
		int num = (int) Math.ceil(circumference);
		num = num - num % 4;

		double angleStep = PI2 / num;


		int temp[] = new int[(int) Math.ceil(circumference)];
		int i = 0;

		int prev = 0;

		for (double ang = 0; ang < PI2; ang += angleStep) {
			int x = (int) Math.round(Math.cos(ang) * radius);
			int y = (int) Math.round(Math.sin(ang) * radius);

			int pixel = y * imgWidth + x;

			if (pixel != prev) {
//                System.out.println("i = "+i+"  x = "+x+"  y = "+y);
				temp[i++] = pixel;
			}
			prev = pixel;
		}

		if (i == temp.length)
			return temp;
		else {
			int ret[] = new int[i];
			System.arraycopy(temp, 0, ret, 0, i);

			return ret;
		}
	}
906032
def angle(self, center1_x, center1_y, center2_x, center2_y):
        
        phi_G = np.arctan2(center2_y - center1_y, center2_x - center1_x)
        return phi_G
1008208
def get_angles(self, angle_id):
        """"""

        tic = datetime.now()

        sunz40km = self._data["ang"][:, :, 0] * 1e-2
        satz40km = self._data["ang"][:, :, 1] * 1e-2
        azidiff40km = self._data["ang"][:, :, 2] * 1e-2

        try:
            from geotiepoints.interpolator import Interpolator
        except ImportError:
            logger.warning("Could not interpolate sun-sat angles, "
                           "python-geotiepoints missing.")
            self.sunz, self.satz, self.azidiff = sunz40km, satz40km, azidiff40km
        else:
            cols40km = np.arange(24, 2048, 40)
            cols1km = np.arange(2048)
            lines = sunz40km.shape[0]
            rows40km = np.arange(lines)
            rows1km = np.arange(lines)

            along_track_order = 1
            cross_track_order = 3

            satint = Interpolator(
                [sunz40km, satz40km, azidiff40km], (rows40km, cols40km),
                (rows1km, cols1km), along_track_order, cross_track_order)
            self.sunz, self.satz, self.azidiff = satint.interpolate()

            logger.debug("Interpolate sun-sat angles: time %s",
                         str(datetime.now() - tic))

        return create_xarray(getattr(self, ANGLES[angle_id]))
214217
public static double angle(Circle circle, double x, double y)
    {
        return angle(circle.getX(), circle.getY(), x, y);
    }
1051992
public function geoWithinCenterSphere(float $x, float $y, float $radius) : self
    {
        $this->query->geoWithinCenterSphere($x, $y, $radius);

        return $this;
    }
532024
function(angles) {
      var s = this['SCALE'];
      
      // Basically treat each angle as a vector, add all the vecotrs up,
      // and return the angle of the resultant vector.

      var y = angles.map(a => Math.sin(a * TAU / s)).reduce((a, b) => a + b);
      var x = angles.map(a => Math.cos(a * TAU / s)).reduce((a, b) => a + b);
      
      // If the resultant vector is very short, this means the average angle is likely wrong or ambiguous.
      // For instance, what if a users asks for the average of the angles [0, PI]?
      
      // TODO: Warn user (or return undefined / null / NaN) when using opposite angles
      // Could be as simple as:
      //if (x * x + y * y < EPS * EPS) return NaN;

      return Math.atan2(y, x) * s / TAU;
    }
1143968
def set_radians(self, angle):
        
        self.x, self.y = math.cos(angle), math.sin(angle)
930877
function(angle) {
    this.dir = (this.dir + angle + circle) % circle;

    // Calculate the rotation vector and update the orientation of the listener.
    var x = Math.cos(this.dir);
    var y = 0;
    var z = Math.sin(this.dir);
    Howler.orientation(x, y, z, 0, 1, 0);
  }
485694
public static void computePositions(Node node, int depth, double aoff, double awid, double radius, double radiusinc) {
    node.x = FastMath.sin(aoff) * radius;
    node.y = FastMath.cos(aoff) * radius;

    // Angular width per weight
    double cwid = awid / node.weight;
    // Avoid overly wide angles - shrink radius if necessary.
    double div = 1;
    if(node.weight > 1) {
      double s = FastMath.sin(awid * .5), c = FastMath.cos(awid * .5);
      double dx = s * (depth + 1), dy = c * (depth + 1) - depth;
      double d = FastMath.sqrt(dx * dx + dy * dy) / MathUtil.SQRT2;
      div = Math.max(div, d);
    }
    // Angular position of current child:
    double cang = aoff - awid * .5 / div;
    final double adjwid = cwid / div;
    for(Node c : node.children) {
      computePositions(c, depth + 1, cang + adjwid * c.weight * .5, adjwid * c.weight, radius + radiusinc, radiusinc);
      cang += adjwid * c.weight;
    }
  }
806686
public function arc($x, $y, $radius, $angle1, $angle2, $context, $x, $y, $radius, $angle1, $angle2)
    {
    }
217958
def xAxisIsMinor(self):
        '''
        
        '''
        return min(self.radius.x, self.radius.y) == self.radius.x
526541
def angle_to(self, rhs):
    

    return math.acos(self.dot(rhs) / (self.magnitude() * rhs.magnitude()))