angle

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 16:07:14
问题 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 direction defined by the angle. It actually doesn't even have to be an arrow, anything graphically showing the value of the angle will do! Here's a picture showing the kind of thing I'm trying to draw: removed dead ImageShack link 回答1: The quiver()

Java Math.cos(Math.toRadians(<angle>)) returns weird values

馋奶兔 提交于 2019-11-27 15:25:47
I've got a little Problem with the Math.cos() method. I know, I have to convert the angle to Radians before using Math.cos() . But if I just do: System.out.println(Math.cos(Math.toRadians(90)); It outputs: 6.123233995736766E-17 Math.sin() is working well. From trigonometry: sin x ~= x, for small values of x sin x = cos x+pi/2 Because pi/2 can't be represented exactly in IEEE-754 Floating point, it means, that it must be off by some value x, i.e it is represented by pi/2 +- x, where x < the least significant bit in the floating point system. Which in this case is 2^-53 = 1.1102e-16. In this

From Cartesian Plot to Polar Histogram using Mathematica

你离开我真会死。 提交于 2019-11-27 15:09:19
问题 Please Consider: dalist={{21, 22}, {26, 13}, {32, 17}, {31, 11}, {30, 9}, {25, 12}, {12, 16}, {18, 20}, {13, 23}, {19, 21}, {14, 16}, {14, 22}, {18,22}, {10, 22}, {17, 23}} ScreenCenter = {20, 15} FrameXYs = {{4.32, 3.23}, {35.68, 26.75}} Graphics[{EdgeForm[Thick], White, Rectangle @@ FrameXYs, Black, Point@dalist, Red, Disk[ScreenCenter, .5]}] What I would like to do is to compute, for each point, its angle in a coordinate system such as : Above is the Deisred output, those are frequency

Inner angle between two lines

你说的曾经没有我的故事 提交于 2019-11-27 14:48:52
问题 I have two lines: Line1 and Line2. Each line is defined by two points (P1L1(x1, y1), P2L1(x2, y2) and P1L1(x1, y1), P2L3(x2, y3)) . I want to know the inner angle defined by these two lines. For do it I calculate the angle of each line with the abscissa: double theta1 = atan(m1) * (180.0 / PI); double theta2 = atan(m2) * (180.0 / PI); After to know the angle I calculate the following: double angle = abs(theta2 - theta1); The problem or doubt that I have is: sometimes I get the correct angle

How to use 4d rotors

爱⌒轻易说出口 提交于 2019-11-27 09:48:20
I'm trying to create a 4D environment, similar to Miegakure 's. I'm having trouble understanding how to represent rotations. The creator of Miegakure wrote this small article explaining he made a class for 4d rotors. http://marctenbosch.com/news/2011/05/4d-rotations-and-the-4d-equivalent-of-quaternions/ How can I implement the functions of this class ? In particular the functions to rotate vectors and other rotors, and getting the inverse ? I would appreciate some pseudocode examples. Thanks a lot to anyone who bothers answering. Solving rotation around arbitrary vector will make you insane in

Angle gradient in canvas

谁都会走 提交于 2019-11-27 08:57:09
I'm looking for a code that permits to have this effect on a canvas' stroke . I've already got an animated circular stroke, I only need to get the ANGLE gradient, not linear and not radial. I've got only 3 colours. The existing one is available here (the review rating) A context strokeStyle can be a gradient: // create a gradient gradient = ctx.createLinearGradient(xStart, yStart, xEnd, yEnd); gradient.addColorStop(0.0,"blue"); gradient.addColorStop(1.0,"purple"); // stroke using that gradient ctx.strokeStyle = gradient; Example code and a Demo using a gradient strokeStyle: http://jsfiddle.net

MinAreaRect angles - Unsure about the angle returned

核能气质少年 提交于 2019-11-27 06:41:30
From the functions for MinAreaRect, does it return angles in the range of 0-360 degrees? I am unsure as i have an object that is oriented at 90 degrees or so but I keep getting either -1 or -15 degrees. Could this be an openCV error? Any guidance much appreciated. Thanks I'm going to assume you're using C++, but the answer should be the same if you're using C or Python. The function minAreaRect seems to give angles ranging from -90 to 0 degrees, not including zero, so an interval of [-90, 0). The function gives -90 degrees if the rectangle it outputs isn't rotated, i.e. the rectangle has two

Determine angle of view of smartphone camera

谁说我不能喝 提交于 2019-11-27 06:25:43
I'm trying to determine the degree size of the field-of-view of a Droid Incredible smartphone's camera. I need to know this value for an application that I'm developing. Does anyone know how I can find out/calculate it programmatically? David Z Unless there's some API call for that (I'm not an Android programmer, I wouldn't know), I would just snap a picture of a ruler from a known distance away, see how much of the ruler is shown in the picture, then use trigonometry to find the angle like this : now you have the two distances l and d from the figure. With some simple goniometry, one can

Fastest way to sort vectors by angle without actually computing that angle

余生颓废 提交于 2019-11-27 05:45:22
问题 Many algorithms (e.g. Graham scan) require points or vectors to be sorted by their angle (perhaps as seen from some other point, i.e. using difference vectors). This order is inherently cyclic, and where this cycle is broken to compute linear values often doesn't matter that much. But the real angle value doesn't matter much either, as long as cyclic order is maintained. So doing an atan2 call for every point might be wasteful. What faster methods are there to compute a value which is

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