This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Hi

Q1 having a "stick match" figure in 3D eg IGES file, how to easely remove "invisible" lines or parts of lines (or in first case find these parts).

Q2 Having the same drawing with some curves as splines, how to "convert" splines to arcs or small line pieces.

both in c/c++

Thanks in advance.

Q1 having a "stick match" figure in 3D eg IGES file, how to easely remove "invisible" lines or parts of lines (or in first case find these parts).

Q2 Having the same drawing with some curves as splines, how to "convert" splines to arcs or small line pieces.

both in c/c++

Thanks in advance.

The general answer I would think is to loop every entity, checking it's property and if its visible=false then delete it.

The 2nd question is going to be very specific to your application.

I know AutoCAD can, but i don't have AutoCAD on the PC.

OS is Win32, the application :-) ? that is what have the problem. It is solid homemade and to complete it i have to do some twistings on vector graphic file of any known kind (or at least the most common of these).

My guesstimate was this :

It has some theretically issues about how to move from 3D to 2D and remove all invisible parts. And how to take a spline or Belzier curve and "convert" it to simple arcs or line pieces.

And i need to find a solution/algrorithm to remove those hidden lines. and do the despline

It all happens in a C++ program that i write the code for.

Thus having Algorithm, miscelanious programming and theory. Sorry if i'm wrong. But If i'm wrong i could never find a better guess.

BRGDs

Klavs.

Q2 Do You meen split it up in same manner as an intergral equation ? having dX and dY small ? Hmm i have thought of that, but wouldn't it be a very very slow process as You might reselect the line size several times, in order to precise enough ?

house.png

spline.PNG

Q2 is almost a guideline and not a solution.

Algorithm will be like

splitting in 10 peaces, testing if middle of point-2-point line is further away from actual curve than gradient factor (eg 0.01). If then jump into a "nested" loop splitting in 10 and so on. If not continue to next point-2-point peace.

Speaking of your algorithm, this is a slightly different part of the problem. Deciding how many segments to use. Theres no single answer, it depends on the usage. Some cases want reasonable description of the curve in the smallest number of segment, so are concerned with accuracy. In other cases the segments have to follow rules, maximum angle or minimum distance.

However, my preferred method involves calculating the angles and distances. A curve goes from point A to point B, you could draw a line between A and B. The curve leaves point a at some angle from that line and arrives at point B with another angle from the AB line. The amount of curvature can be described with those angles.

If the curve is almost a straight line between A and B, those angles will be very small, so you will tend to get less segments. If the curves was actually a straight line, the angles would both be zero, so no dividing segments.

You can also use the distance from A to B, depending on what sort of fitting you want. A short line might be considered to need fewer segments than a long line.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

Or things which are hidden because they are on a hidden layer or something similar?

2. Curves are generated with homogenous functions that are evaluated between two control points, from 0 to 1 at either point. There are many functions to shape the curve, you need to know which is being used (splines on Wikipedia).

To divide a curve into 10 line segments, generate points by evaluating the function at 0.0, 0.1, 0.2, 0.3 etc, and join these points with line segments.

It might be sensible to separate this into two questions. Each answer could become complicated.