Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Other Forums > Math and Physics


Math and Physics Discuss the complex nature of mathmatics and physics relating to electronic circuitry.

Reply
 
Thread Tools Display Modes
Old 21st March 2008, 03:51 PM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default Calculating a point a specified distance away from another poin

Im utterly sick of eagle, so ive started work on a pcb editor and have now got side tracked on the graphics editor element of the project.

Does anyone know how to calculate a point that is a specified distance away from another along a line?

Ive defined a straight line class in c# that can encapsulate all the maths and its all working nicely appart from this.

In the rest of the class, i use y=mx+c and pyt. a² = b² + c² forumulas to calculate length, x from y, y from x etc.

Everything on the web talks about finding the distance between two points, but I allready know how to do that, i want to find a point, given a distance!

Many thanks,
Chris
__________________
Chris
HerbertMunch is offline   Reply With Quote
Old 21st March 2008, 04:59 PM   (permalink)
3v0
Moderator
 
Blog Entries: 3
3v0 is a splendid one to behold3v0 is a splendid one to behold3v0 is a splendid one to behold3v0 is a splendid one to behold3v0 is a splendid one to behold3v0 is a splendid one to behold3v0 is a splendid one to behold
Default

Chris,
That is a lot of work to do by yourself.

If you want to go that route join an open source project to do the same. There should be a few out there.
You may want to look at the gEDA project.

Quote:
The gEDA project is working on producing a full GPL‘d suite of EDA (Electronic Design Automation) tools. These tools are used for electrical circuit design, schematic capture, simulation, prototyping, and production. Currently, the gEDA project offers a mature suite of free software applications for electronics design, including schematic capture, attribute management, bill of materials (BOM) generation, netlisting into over 20 netlist formats, analog and digital simulation, and printed circuit board (PCB) layout.
For what it is worth you need a point and a direction to find the second point.
__________________
search engine for electronic parts
Junebug USB PIC programmer kit. USB Bit Wacker
3v0 is online now   Reply With Quote
Old 22nd March 2008, 01:38 AM   (permalink)
Experienced Member
 
ClydeCrashKop is on a distinguished road
Default

This file arcline.txt is an OLD Old old program I wrote for GWBASIC or BASICA. It plots an arc across 3 points on the screen. It may plot smooth contours from points 2,3&4 then points 3,4,5 averaging the first part of an arc with the last part of the previous arc. Are you confused yet?
Anyway, what you want is in there. You just have to find it. If you have GWBASIC or BASICA, you can load it as a txt file and run it and see how it works. If you modify it, save it as a BAS file.
If you don’t have GWBASIC or BASICA, you can get it online and full manual or I can ZIP them for you.
Attached Files
File Type: txt Arcline.txt (3.6 KB, 5 views)
__________________
C:\WHUT ?
Beware the asterisk *

Last edited by ClydeCrashKop; 22nd March 2008 at 03:02 PM.
ClydeCrashKop is offline   Reply With Quote
Old 22nd March 2008, 04:12 PM   (permalink)
Experienced Member
 
ClydeCrashKop is on a distinguished road
Default

WITH NUM LOCK ON MOVE PIXEL WITH 1 - 9. 5 LETS YOU ENTER A POINT 1,2,3 OR 4
IF YOU ENTER 4,IT PLOTS ARC USING THE LAST TWO POINTS AS 1 & 2

I was wrong, it doesn’t plot an average, just more arcs. This is a better copy because the input prompt was confusing.
In GWBASIC, CTRL > Break stops the program and SYSTEM, Enter gets you back to Windows. It may run in Q-BASIC as well.
Attached Files
File Type: txt Arcline.txt (3.6 KB, 3 views)
__________________
C:\WHUT ?
Beware the asterisk *
ClydeCrashKop is offline   Reply With Quote
Old 27th March 2008, 04:11 PM   (permalink)
Experienced Member
 
phalanx is on a distinguished road
Default

Quote:
Originally Posted by HerbertMunch
Everything on the web talks about finding the distance between two points, but I allready know how to do that, i want to find a point, given a distance!

Many thanks,
Chris
You would also need to know direction (angle) from your starting point in order to find a new point.

Your new point would simply be:

Xnew = Xorig + dist*sin(angle)
Ynew = Yorig + dist*cos(angle)
phalanx is offline   Reply With Quote
Old 27th March 2008, 08:13 PM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default

Quote:
Originally Posted by phalanx
You would also need to know direction (angle) from your starting point in order to find a new point.

Your new point would simply be:

Xnew = Xorig + dist*sin(angle)
Ynew = Yorig + dist*cos(angle)
Nice one mate. Thanks very much.

I have a gradient (y=Mx+c). How would i go about turning M into degrees?

Many thanks.
__________________
Chris
HerbertMunch is offline   Reply With Quote
Old 27th March 2008, 10:13 PM   (permalink)
Experienced Member
 
phalanx is on a distinguished road
Default

Quote:
Originally Posted by HerbertMunch
Nice one mate. Thanks very much.

I have a gradient (y=Mx+c). How would i go about turning M into degrees?

Many thanks.
M is your slope which is defined as your rise over your run: ΔY/ΔX

The tangent of an angle is calulated by dividing the rise by the run so if you take the inverse tangent of your slope, you will get the angle: tan-1(M) = angle.

For instance, if your line is defined as y=x+4, your slope is "1" and the tan-1(1)= 45°

Make sure you know if your code is working in degrees or radians. If need be you can convert between them.

Last edited by phalanx; 27th March 2008 at 10:20 PM.
phalanx is offline   Reply With Quote
Old 28th March 2008, 10:26 AM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default

Quote:
Originally Posted by phalanx
M is your slope which is defined as your rise over your run: ΔY/ΔX

The tangent of an angle is calulated by dividing the rise by the run so if you take the inverse tangent of your slope, you will get the angle: tan-1(M) = angle.

For instance, if your line is defined as y=x+4, your slope is "1" and the tan-1(1)= 45°

Make sure you know if your code is working in degrees or radians. If need be you can convert between them.
thanks very much. that works perfectly!
__________________
Chris
HerbertMunch is offline   Reply With Quote
Old 7th April 2008, 01:23 AM   (permalink)
HS3
Experienced Member
HS3 has a spectacular aura about
Default

Converting TAN to angle in order to get SIN and COS is not the best way to do it because you need more calculation and will get higher error.
This is better
SIN=SQRT(1/(1+1/M^2))
COS=SQRT(1/(1+M^2))
HS3 is offline   Reply With Quote
Old 13th April 2008, 07:40 PM   (permalink)
Experienced Member
petrv will become famous soon enough
Default

Sick of Eagle ? I can see why but I am still using it - I don't know about anything better that is also affordable (I like very much Orcad Capture for schematic capture - so easy to work with). Did you try Kicad ? it is also open-source and unlike gEDA there is a version for Windows.

Petr
petrv is offline   Reply With Quote
Old 14th April 2008, 09:43 AM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default

Quote:
Originally Posted by HS3
Converting TAN to angle in order to get SIN and COS is not the best way to do it because you need more calculation and will get higher error.
This is better
SIN=SQRT(1/(1+1/M^2))
COS=SQRT(1/(1+M^2))
Just got an email from the forum, sorry for not replying sooner. Thanks very much for your input. The way that you suggest is indeed better, thanks.

Quote:
Originally Posted by petrv
Sick of Eagle ? I can see why but I am still using it - I don't know about anything better that is also affordable (I like very much Orcad Capture for schematic capture - so easy to work with). Did you try Kicad ? it is also open-source and unlike gEDA there is a version for Windows.

Petr
I cant agree more. though Eagle has actually put me off electronics at the moment.
I seem to be a very single minded induvidual. I can only seem to be interested in one thing at any one time. Then ill start doing something else, and that something else is a replacement for eagle. Ill probably get sidetracked in about a month or two though!

I think ive tried just about all of the bad bunch of packages.
I have heard good things about orcad (my uni uses it, for example) but its not for me. I cant even remember all the reasons why i didnt like it, but i think one of the reasons was that it consists of about 10 seperate programs, and another was the slightly dated feel of the UI.
I think that this separate program idea is shite, and is probably a throw back to days gone by.

Here are my biggest problems with eagle:

Visual artefacts pollute the screen a lot of the time, requiring user to zoom in/out to remove them. It would appear that the makers of Eagle, never fully understood Win32API Invalidate method!

The stupid wrench tool. Why group so many options under one roof?

The component search dialog, which is horrendous.

Not enough autonomy. My program will make naming nets, etc easier, and will (hopefully) bring many new innovations to the humble schem capture and pcb editor package market.

Ive decided not to join an open source project myself, as I have a very clear idea of what I want from my program, not to mention that the encapsulated components that Im creating will come in handy as the building blocks for many future projects.

So far, i have completed a large chunk of the vector graphics class that is at the heart of the pcb and schem capture.

Now Im finally free to start on the meat of the application. the electronic specific parts.

Depending on the quality, and stability of the application (which is quite good so far!) and also If i receive enough interest, I may sell the program at a very reasonable price (something aimed at the hobbyist).

My original thoughts were to create a freeware package, but that’s gone out the window, now that I’ve realised how much work (not to mention time) is needed to complete the project to a professional standard.

When my project is nearing a more completed state, I will purchase some web space, and distribute a beta test .
__________________
Chris

Last edited by HerbertMunch; 14th April 2008 at 03:16 PM.
HerbertMunch is offline   Reply With Quote
Old 14th April 2008, 08:01 PM   (permalink)
Experienced Member
petrv will become famous soon enough
Default

Yes this lack of auto-redraw is really stupid (even a simple double-buffering algorithm would fix that) but you do not need to zoom in and out, just press F2
or in the layout editor you can also click the Ratsnest icon which will also cause a redraw.

Petr
petrv is offline   Reply With Quote
Old 15th April 2008, 12:23 AM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default

hopefully i wont have to use eagle ever again!
__________________
Chris
HerbertMunch is offline   Reply With Quote
Old 15th April 2008, 12:26 AM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default

Also another thing about eagle; it seems to "forget" about some connections when creating pcb air wires. I have created entire boards and relied on eagle to connect air wires to everything that should be connected, and only when id etched and started to solder did i realise that some things werent connected.

I need something a bit more reliable. And whats the point of the schem capture if it doesnt allways translate properly into airwires?
__________________
Chris
HerbertMunch is offline   Reply With Quote
Old 18th April 2008, 11:47 AM   (permalink)
Experienced Member
jpanhalt is just really nicejpanhalt is just really nicejpanhalt is just really nicejpanhalt is just really nice
Default

Quote:
Originally Posted by HerbertMunch

The stupid wrench tool. Why group so many options under one roof?
I use v.4.14. Tried the new beta and didn't like that aspect either.

Quote:
Also another thing about eagle; it seems to "forget" about some connections when creating pcb air wires.
Do you run ERC on the schematic? The usual cause of "forgetting" an airwire is that the wire is not actually connected to the pin on the schematic. Only wires connected to pins at both ends show in the PCB. It may look like it is connected in the schematic, but in fact it may simply be overlaying the pin. ERC finds that and reports a non-connected pin.

Sorry to come so late. I read the original post and then didn't follow the thread. I hope these suggestions help. BTW, I did not like the EAGLE beta. There were some minor improvements, but I found many of the changes a disadvantage. I particularly didn't like the new select feature. John.
jpanhalt is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Distance measurement project bigfarmerdave Electronic Projects Design/Ideas/Reviews 13 14th December 2007 06:42 PM
Using Oscilloscopes mechie Electronic Theory 9 29th November 2007 09:48 PM
Looks simple enough. But..... hjl4 Micro Controllers 3 29th January 2007 11:17 AM
SIMPLE ADC PROBLEM neelam29 Micro Controllers 2 9th March 2006 08:46 AM
ya mari_69 Micro Controllers 4 7th June 2004 01:29 PM



All times are GMT. The time now is 11:02 PM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.