Questions tagged [angle]

A shape, formed by two lines or rays diverging from a common point (the vertex).

Angle is also used to designate the measure of an angle or of a rotation. This measure is the ratio of the length of a circular arc by its radius. In the case of an angle (figure), the arc is centered at the vertex and delimited by the sides. In the case of a rotation, the arc is centered at the center of the rotation and delimited by any point and its image by the rotation.

Source: mathopenref wikipedia

1421 questions
16
votes
3 answers

Average of two angles with wrap around

Possible Duplicate: How do you calculate the average of a set of circular data? I have two angles, a=20 degrees and b=350 degrees. The average of those two angles are 185 degrees. However, if we consider that the maximum angle is 360 degrees and…
Mizipzor
  • 51,151
  • 22
  • 97
  • 138
15
votes
2 answers

XNA 2D vector angles - what's the correct way to calculate?

what is in XNA in 2D the standard way vector angles work ? 0 degrees points right, 90 points up, 180 left, 270 down ? What are the 'standard' implementations of float VectortoAngle(Vector2 vec) and Vector2 AngleToVector(float angle) so that…
Led
  • 2,002
  • 4
  • 23
  • 31
13
votes
3 answers

Sorting list of two-dimensional coordinates by clockwise angle using Python?

I have a set of points with x and y coordinates that can be seen in the figure below. The coordinates of the 9 points were stored in a list as follows: L = [[5,2], [4,1], [3.5,1], [1,2], [2,1], [3,1], [3,3], [4,3] , [2,3]] The idea is to sort the…
Jayme Muzzi
  • 133
  • 1
  • 1
  • 8
13
votes
2 answers

Calculate angle (degrees) in Python between line (with slope x) and horizontal

I need to calculate the angle between a line and the horizontal. My high school maths seems to be failing me. import matplotlib.pyplot as plt import numpy as np x = [8450.0, 8061.0, 7524.0, 7180.0, 8247.0, 8929.0, 8896.0, 9736.0, 9658.0, 9592.0] y…
ljc
  • 943
  • 2
  • 10
  • 26
13
votes
4 answers

start and end angle of UIBezierPath?

I have coded as below for half circle in iOS using UIBezierPath and CAShapeLayer. clockWiseLayer = [[CAShapeLayer alloc] init]; CGFloat startAngle = -M_PI_2; CGFloat endAngle = M_PI + M_PI_2; CGFloat width = CGRectGetWidth(imageView.frame)/2.0f +…
Sam Shaikh
  • 1,596
  • 6
  • 29
  • 53
13
votes
1 answer

Rotate marker based on driving direction

I have a marker in my Google Maps map that looks like this: When the user is driving, I want to rotate it based on his driving direction. How can I achieve this? I should probably use previous location and current location coords for calculation,…
Gintas_
  • 4,940
  • 12
  • 44
  • 87
13
votes
3 answers

How to calculate wind direction from U and V wind components in R

I have U and V wind component data and I would like to calculate wind direction from these values in R. I would like to end up with wind direction data on a scale of 0-360 degrees, with 0° or 360° indicating a wind blowing to the north, 90°…
Emily
  • 859
  • 5
  • 14
  • 31
13
votes
2 answers

Mask a circular sector in a numpy array

I have a code that slices a numpy array into a circle. I wish to recover only the values included in a certain range of angles from the circle and mask the array. For example: mask the original array with the (x,y) positions comprised between 0 and…
Guadancil11
  • 625
  • 3
  • 8
  • 16
13
votes
3 answers

How do I display an arrow positioned at a specific angle in MATLAB?

I am working in MATLAB and I'm stuck on a very simple problem: I've got an object defined by its position (x,y) and theta (an angle, in degrees). I would like to plot the point and add an arrow, starting from the point and pointing toward the…
Aurélien
  • 153
  • 1
  • 1
  • 6
12
votes
4 answers

Calculate direction angle from two vectors?

Say I have two 2D vectors, one for an objects current position and one for that objects previous position. How can I work out the angular direction of travel? This image might help understand what I'm after: (image)…
ingh.am
  • 25,981
  • 43
  • 130
  • 177
12
votes
5 answers

Calculating Standard Deviation of Angles?

So I'm working on an application using compass angles (in degrees). I've managed to determine the calculation of the mean of angles, by using the following (found at…
snotyak
  • 3,709
  • 6
  • 35
  • 52
12
votes
4 answers

Calculate rotations to look at a 3D point?

I need to calculate the 2 angles (yaw and pitch) for a 3D object to face an arbitrary 3D point. These rotations are known as "Euler" rotations simply because after the first rotation, (lets say Z, based on the picture below) the Y axis also rotates…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
11
votes
3 answers

Calculate vector with given angle and length

Is there any way in which, in javascript, I can call a function with an x and y co-ord and a direction (angle in degrees) and it will return a set of new co-ords that has been 'moved' by 10px in the direction given from the original co-ords? I…
Bobdinator
  • 137
  • 1
  • 1
  • 5
10
votes
2 answers

Quaternions vs Axis + angle

I have been trying to find the difference between the 2 but to no luck minus this The primary diff erence between the two representations is that a quaternion’s axis of rotation is scaled by the sine of the half angle of rotation, and instead…
Chris Condy
  • 626
  • 2
  • 9
  • 25
10
votes
1 answer

get tilt angle Android

I'm trying to get the tilt angle, roll angle from my sensors from my android phone but with no success so far, when I click on my button which should give me the 3 angles, I get "results: 0.0 -0.0 -0.0" package com.example; import…
Mike Bryant
  • 2,455
  • 9
  • 39
  • 60
1 2
3
94 95