I made a slider that changes the angle the line needs to be slanted at. angle = new JSlider(SwingConstants.HORIZONTAL, 0, 180, 90); angle.setSize(300, 50); angle.setLocation(650, 60); angle.setPaintTicks(true); angle.setPaintTrack(true); angle.setMinorTickSpacing(10); angle.setMajorTickSpacing(30); angle.setPaintLabels(true); angle.addChangeListener(this); thepanel.add(angle); How do I draw a line that implements this angle? edit: public void paintComponent(Graphics g){ super.paintComponent(g); int...

C++, I want calculate the angle of the direction of the two points. Here is a picture which shows the two points and the direction of how to get the angle of the direction? p1 - start point. p2 - direction point. me need direction angle(facing?) from p1 to p2...

I'm trying to deduce the pendulum equation out of the Verlet algorithm. This is what I've done with phython using "r" as the angle of the pendulum, "w" as the speed and "a" as the angular acceleration. "h" is the increase of time, and my main problem is that if...

In the diagram below all points are in 3D space (x, y, z) and in the same plane BC defines a vector with midpoint A PA should be perpendicular to BC, however I do not know how to find P I need to determine the angle between OA and PA...

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...

I'm using the Racket GUI to write text in the window of my program. Until now I only needed to draw text horizontally. But now I would also want to write text vertically. I saw in the documentation we can give an "angle" argument when we send the message "draw-text"...

I am using this equation to work out the angles of my x, y and z compared to gravity: directionalVector = Math.Sqrt(Math.Pow(accelForceX, 2) + Math.Pow(accelForceY, 2) + Math.Pow(accelForceZ, 2)); accelAngleX = (Math.Acos(accelForceX / directionalVector) * (180f / Math.PI)); ; accelAngleY = (Math.Acos(accelForceY / directionalVector) * (180f / Math.PI)); accelAngleZ =...

I have 2 points in an x, y plane. I want to rotate one point onto the other point by rotating it about the z-axis. How can I find the angle to rotate one point onto the other?...

I calculated a mean angle of below two angles. 337.477792 324.8119785 I used the formula to calculate a mean angle (see below #Distribution of the mean) http://en.wikipedia.org/wiki/Directional_statistics What I got was 28.85511475 / -28.8551147. The values don't look right ... Wonder if someone can explain this result for me? Thank...

I have an object which wants to move from point A to point B, at a certain speed (using SFML C++). sf::Vector2f aPos; //sf::Vector2f has two members x and y, stored as floats sf::Vector2f bPos; float speed; //pixels per tick I want to use these variables to find out a...

I would like to get an angle in terms of 360 degrees... for my game, I need to know which direction the player is heading in... The code here gets the proper angles, but only in terms of 90 degree increments: (meaning, when I click in upper left quadrant, I...

I have question about the formula to calculate the Angle between two points p1(x1,y1), p2(x2,y2). I use this formula : angle = arctan(y2-y1/x2-x1) Can you explain, why y2,y1 and x2,x1 must be subtracted ? Thanks...

I am working on programming a game. In this game, there is an object that needs to rotate to face another object. Code: Here is what I have done: //targetAngle is defined to be the angle pointing towards the other object //angle is the angle of this object angle +=...

I have two lines specified by two points with x and y coordinate each. The first point (where the lines begin) is equal meaning that I have 3 points A, B and C where one line is from A to B and the other one from A to C. I...

How would you calculate the degrees between two points on the edge of a circle in Swift. ...

I am trying to calculate some rough angles on the x-axis from an onboard accelerometer on the light blue bean (https://punchthrough.com/bean/). Issue: Everything I calculate comes back as 0 or -1. So I am obviously either passing something wrong, or converting something wrong. I am unsure what. Thought I would...