
Elementary Math Fractions, Percentages, Word Problems, Equations, Inequations, Factorization, Expansion 
 LinkBack  Thread Tools  Display Modes 
September 8th, 2017, 12: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 
September 8th, 2017, 01: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) 
September 8th, 2017, 01: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. 

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 11:40 AM 
How to calculate hinge position  Gate Lift  wbsatwestmount  Algebra  0  October 27th, 2013 11:40 AM 
Calculate 3dimensional position.  ikkentim  Algebra  2  August 22nd, 2012 06:34 AM 
calculate point on a line  olibara  Algebra  9  December 28th, 2011 11:51 AM 
wrong position for a perpendicular line  collinm  Algebra  3  November 22nd, 2009 01:46 PM 