Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

A problem of geometry, assistance needed

Status
Not open for further replies.

PeterCharles

Mechanical
Oct 31, 2002
423
I could do with some assistance here!

I have three points that I know the coordinates of, "C" the centre of an arc, "S" the start point of the arc, "E" the end point of the arc.

Clearly, the arc will be either clockwise or anti-clockwise about "C".

If I draw out the three points I can immediately see the rotation, but I'm looking for a geometric/mathematical method to determine the rotation. I need to incorporate this into a program I'm writing.

Currently I'm a bit stuck!!
 
Replies continue below

Recommended for you

There are several ways of determining the direction of rotation, but in this case it may be easier to calculate the two angles involved; the angles of CE and CS to the horizontal, call them ECX and SCX. Then it's a simple IF/THEN operation to find the greater of the two.
Code:
    IF AngleECX>AngleSCX THEN R=POS ELSE R=NEG
    IF AngleECX=AngleSCX THEN GOTO .....
This is assuming that an Anti-clockwise rotation is Positive.

Whilst doing this by looking at angles there is an opportunity to check that each point is exactly equidistant from C.

 
Ah but ....

1) let the start angle SCX be 350 degrees
2) let the end angle ECX be 10 degrees

then since SCX > ECX the rotation would be would be given as NEG, whereas its actually POS, that's why I'm stuck.


:-((


 
You can't tell which direction something moves over a closed circuit just by knowing its start and end points. Think about it - if you know where a car starts and ends on a racetrack, but you're not allowed to see it move, there is no way of knowing if it went clockwise or counterclockwise.

Unless you make a rule such as "it will always travel the shortest distance", you can't know...
 
A good point.

If SCX=190 and ECX=10 then there are two equal and opposite, ways to rotate. So, if the critical angle is ECX+180, then we can find which route is shorter.

But if ECX is more than 180 then the critical angle will be ECX-180.
Code:
IF ECX > 180 THEN CriticalAngle=ECX-180
             ELSE CriticalAngle=ECX+180

IF SCX>CriticalAngle AND SCX<ECX THEN R=POS 
IF SCX>CriticalAngle AND SCX>ECX THEN R=NEG 
            IF SCX<CriticalAngle THEN R=NEG


 
I'll expand on the problem a bit.

The arc is part of the loop path traced out by a laser cutter which consists of lines and arcs. I know the overall rotation of the path be it clockwise or anti-clockwise. The lines are straight with a start point and end point, so no problem.

However within the context of the loop the arcs may be clockwise or anti-clockwise about their respective arc centres depending on the position of the arc centre relative to the loop. If the centre is "inside" the loop then the rotation is the same loop, but if it is "outside" then the rotation is opposite to the loop. (Does this make sense?)

 
Your last paragraph clears it up completely. You're right, this is a very easy thing to see when you draw the loop. This requires you to visualize the entire loop. However, for a computer program to calculate whether the center point is inside or outside the loop is going to be impossible without considering the geometry of the entire loop - a formidable undertaking indeed!
 
"... a formidable undertaking indeed!"

Hence the request for assistance :)
 
when you draw the cutter path it obvious, 'cause you've got the "big picture" and a little common sense.

visualise a path from a vertical line to a horizontal line heading to the right. the direction of the cutter (from up to the right) has rotated CW, so the arc would also be CW, center to the right of the original line.

btw, isn't an angle of 180deg meaningless (in this context)?

also, one point to consider is a sharp corner (ie corner radius = cutter radius)
 
PeterCharles
the information you provided is not yet sufficient to decide.
You can easily connect two lines with an arc whose center will lie inside the loop if you go one way and outside if you go the other way.
Is there any other restraint for your arcs you didn't mention? Are for example the tangents to the arc in the endpoints coincident with the line segment connected to each endpoint?
Also: when you say that the center is internal to the loop, is this the same as saying that it will be internal to the loop obtained by joining all the points with lines? A simple mathematical check can determine the internity of a point to a poligonal closed loop (with no crossing lines of course).

prex

Online tools for structural design
 
"also, one point to consider is a sharp corner (ie corner radius = cutter radius)"
The laser is quite happy with square corners.

I was wondering if checking how the slope of the arc varied in the direction of travel might give a clue .....
 
What are you using as input, something like a .dxf file?
 
The input file is the file (plain text) produced by the laser programming software (which we no longer have access to). I'm attempting to reverse engineer this to produce a DXF file. It's just the arcs that are a problem.
 
maybe a NC programming company could help ?

maybe the inherent logic is to choose the shorter path ? (so if you wanted a 270deg cut you'd define this as two 135 deg cuts)
 
This may be a stupid question, but I'll ask it anyway:

Do you know the desired shape of the output path? If so, can you generate your path by arbitrarily selecting either a CW or CCW direction for your arcs and then finalize the path manually by correcting the arcs that are wrong? I have no idea how many files you need to do, but it seems that you'll need to verify the path in some fashion after the DXF is generated anyway. I would imagine that any arcs that get generated in the wrong direction would be painfully obvious, but that's total supposition on my part.

Or are you trying to generate a path that you know nothing about other than what's being given in the text file? If this is the case, I wish you the best of luck.
 
prex,
"A simple mathematical check can determine the internity of a point to a poligonal closed loop" Could you give me a clue please.

dgowans,
No question is stupid.

1)The data in the text file tells me if the loop is clockwise or anti-clockwise.
2)I can always check the DXF after creating it as the error will be obvious. But ideally I'd like to get the conversion right.
3)The directory contains 40,000 files of which maybe 25-30,000 are laser profiles. Whether we need them all again is another matter, but there are attractions if we could do a "one hit" with a program.


"Smile and be happy, things could be worse.
So I smiled and was happy and sure enough things got worse!"
 
???

if the data file tells you the start, stop, and center positions, and whether the arc is CW or CCW ...

what else is there to figure out ??

if you're looking to check your conversion, could you use your translated file to generate the equivalant input file and compare the two files ?
 
What else is in the text file? It sounds like you've figured out how to get the center, start, and end points of each arc. If the laser is supposed to run with just what's in the text file then there has to be something in there that tells the laser which direction to go. Would it be an information security problem to post a couple of text files with their corresponding DXFs for reference?

How Do I Make Files Available For Download? ... No Emails Required faq559-1177
 
rb1957:
I almost posted the exact same thing until I noticed that he said he knew the direction of the loop (i.e. the overall travel direction wrt the shape's center), not each arc(wrt its center).
 
fair enough, but then there has to be something to tell the machine what to do ... conceptually either arc will satisfy the geometry (as described), but the macine doesn't guess which one's right ... and it does it right every time (well nearly)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor