My Math Forum  

Go Back   My Math Forum > High School Math Forum > Elementary Math

Elementary Math Fractions, Percentages, Word Problems, Equations, Inequations, Factorization, Expansion


Thanks Tree1Thanks
  • 1 Post By prestondocks
Reply
 
LinkBack Thread Tools Display Modes
September 8th, 2017, 01:27 PM   #1
Newbie
 
Joined: Sep 2017
From: UK

Posts: 3
Thanks: 1

calculate compass line position on LCD Display

Hi, Sorry but my maths has never been good, so I need some help. I am working on a micro controller project that display a moving compass needle on an LCD screen.

The LCD screen is not square it is 84 pixels wide and 48 pixels high.

I know the center point of my compass ellipse (18, 15) and it has a width of 18 pixels and a height of 15 pixels.

I need a formula that I can use in my program that given a compass heading of for example 90 deg calculates the coordinates of the end of the line I need to draw.

i.e My line would start at the center of the circle (18, 15) and would in this case be drawn to point (36, 15)

I am assuming that Pi needs to part of the equation, but I my maths is just not that good.

Many thanks for any help
prestondocks is offline  
 
September 8th, 2017, 02:09 PM   #2
Newbie
 
Joined: Sep 2017
From: UK

Posts: 3
Thanks: 1

I found another website that gave me the formula. If anyone else is interested the link is here. Analog Clock for Graphic LCD: 4 Steps

The formula for calculating the coordinate of the end of the line using my example above and using 240 deg as an example would be

x = 18 + 18 * sin(240)

y = 15 - 15 * cos(240)
prestondocks is offline  
September 8th, 2017, 02:12 PM   #3
Newbie
 
Joined: Sep 2017
From: UK

Posts: 3
Thanks: 1

Solution found

I used a solution I found on this web site. Analog Clock for Graphic LCD: 4 Steps

using my situation above, the calculation to get the coordinates of the end of the compass hand for an example direction of 240 deg would be

x = 18 + 18 * sin(240) = 2

y = 15 - 15 * cos(240) = 22

It works like a charm.
Thanks from greg1313
prestondocks is offline  
Reply

  My Math Forum > High School Math Forum > Elementary Math

Tags
calculate, compass, display, lcd, line, position



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate the center of a circle given a tangent line lauchagonzalez Trigonometry 3 November 19th, 2013 12:40 PM
How to calculate hinge position - Gate Lift wbsatwestmount Algebra 0 October 27th, 2013 12:40 PM
Calculate 3-dimensional position. ikkentim Algebra 2 August 22nd, 2012 07:34 AM
calculate point on a line olibara Algebra 9 December 28th, 2011 12:51 PM
wrong position for a perpendicular line collinm Algebra 3 November 22nd, 2009 02:46 PM





Copyright © 2017 My Math Forum. All rights reserved.