FAQ Database Discussion Community

## Calculating angles between line segments (Python) with math.atan2

python,trigonometry,angle,atan2,cartesian-coordinates
I am working on a spatial analysis problem and part of this workflow is to calculate the angle between connected line segments. Each line segment is composed of only two points, and each point has a pair of XY coordinates (Cartesian). Here is the image from GeoGebra. I am always...

## Incorrect Polar - Cartesian Coordinate Conversions. What does -0 Mean?

c++,polar-coordinates,cartesian-coordinates
I am getting incorrect conversions from polar to cartesian coordinates and vice versa. My code produces weird points like (1,-0). Im using this calculator to check my conversions. Also one of the conversions is completely wrong when I convert back to cartesian coordinates. Point b: (0,1) => (1,1.5708) => (0,0)...

## I need help graphing a spherical equation in Cartesian coordinates in MATLAB

matlab,surf,cartesian-coordinates
I know about the function sph2cart, but I feel like I must be using it wrong. In a Calculus textbook, I saw that this following spherical equation ρ = 1 + 1/5*sin(6θ)*sin(5Φ) produces something that looks like this I wanted to reproduce this in a Matlab graph, so I wrote...