degrees

Lat Long to Minutes and Seconds?

♀尐吖头ヾ 提交于 2019-11-27 07:44:19
问题 Google Maps gives me the Lat and Long of a location in decimal notation like this: 38.203655,-76.113281 How do I convert those to Coords (Degrees, Minutes , Seconds) 回答1: 38.203655 is a decimal value of degrees. There are 60 minutes is a degree and 60 seconds in a minute (1degree == 60min == 3600s). So take the fractional part of the value, i.e. 0.203655, and multiply it with 60 to get minutes, i.e. 12.2193, which is 12 minutes, and then repeat for the fractional part of minutes, i.e. 0.2193

Java: Calculating the angle between two points in degrees

帅比萌擦擦* 提交于 2019-11-27 03:33:49
I need to calculate the angle in degrees between two points for my own Point class, Point a shall be the center point. Method: public float getAngle(Point target) { return (float) Math.toDegrees(Math.atan2(target.x - x, target.y - y)); } Test 1: // returns 45 Point a = new Point(0, 0); System.out.println(a.getAngle(new Point(1, 1))); Test 2: // returns -90, expected: 270 Point a = new Point(0, 0); System.out.println(a.getAngle(new Point(-1, 0))); How can i convert the returned result into a number between 0 and 359? you could add the following: public float getAngle(Point target) { float angle

Rotate point about another point in degrees python

一曲冷凌霜 提交于 2019-11-27 01:46:57
问题 If you had a point (in 2d), how could you rotate that point by degrees around the other point (the origin) in python? You might, for example, tilt the first point around the origin by 10 degrees. Basically you have one point PointA and origin that it rotates around. The code could look something like this: PointA=(200,300) origin=(100,100) NewPointA=rotate(origin,PointA,10) #The rotate function rotates it by 10 degrees 回答1: The following rotate function performs a rotation of the point point

Convert DD (decimal degrees) to DMS (degrees minutes seconds) in Python?

浪子不回头ぞ 提交于 2019-11-26 20:56:07
问题 How do you convert Decimal Degrees to Degrees Minutes Seconds In Python? Is there a Formula already written? 回答1: This is exactly what divmod was invented for: >>> def decdeg2dms(dd): ... mnt,sec = divmod(dd*3600,60) ... deg,mnt = divmod(mnt,60) ... return deg,mnt,sec >>> dd = 45 + 30.0/60 + 1.0/3600 >>> print dd 45.5002777778 >>> decdeg2dms(dd) (45.0, 30.0, 1.0) 回答2: Here is my updated version based upon Paul McGuire's. This one should handle negatives correctly. def decdeg2dms(dd): is

210. 课程表 II

断了今生、忘了曾经 提交于 2019-11-26 17:21:01
https://leetcode-cn.com/problems/course-schedule-ii/submissions/ 拓扑排序 代码: public int[] findOrder(int numCourses, int[][] prerequisites) { //初始化图 键---值 键是表头节点 值是表边节点 Map<Integer,List<Integer>> map=new HashMap<>(16); int[] degrees=new int[numCourses]; int[] nums=new int[numCourses]; for (int i=0;i<prerequisites.length;i++){ int end=prerequisites[i][0]; int start=prerequisites[i][1]; List<Integer> list = map.get(start); if(list!=null){ list.add(end); }else{ map.put(start,new ArrayList<>()); map.get(start).add(end); } degrees[end]++; } int j=0; Queue<Integer> queue=new LinkedList<>(); for(int i=0

Java: Calculating the angle between two points in degrees

孤街醉人 提交于 2019-11-26 10:32:36
问题 I need to calculate the angle in degrees between two points for my own Point class, Point a shall be the center point. Method: public float getAngle(Point target) { return (float) Math.toDegrees(Math.atan2(target.x - x, target.y - y)); } Test 1: // returns 45 Point a = new Point(0, 0); System.out.println(a.getAngle(new Point(1, 1))); Test 2: // returns -90, expected: 270 Point a = new Point(0, 0); System.out.println(a.getAngle(new Point(-1, 0))); How can i convert the returned result into a