Removing hiddenlines and unspline splined curves.

Posted on 2012-08-23
Last Modified: 2013-12-14

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.
Question by:lhademmor
    LVL 13

    Expert Comment

    I think you've picked the wrong categories for this. This questions sounds specific to IGES or AutoCAD or something, not the 3 categories you've chosen.

    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.

    Author Comment

    No cause this task is to be done on every kind of 3d file type not only IGES, and without AutoCAD or SolidWorks on the calculating PC.

    Author Comment

    Forgot to say more like on everykind of vectorgraphic file in  3D were i need to "convert" it to 2D and delete everything "non visible".

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

    Author Comment

    Dear moderator.

      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.

    LVL 12

    Accepted Solution

    1. Can you explain exactly what is meant by invisible in this case?  Do you mean things that can't be seen because they are behind other things (Hidden Line Removal)?

    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.

    Author Comment

    Q1  Yes hidde line removal everything is surposed to be at only 1 layer. My little house is handdrawn :-), the red lines are hidden and are surposed to be removed.

    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 ?

    Author Closing Comment

    Q1 is not entirely answered but i can look at the WIKI for further information :-).

    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.
    LVL 12

    Expert Comment

    I'm sorry lhademmor, I didn't have time to return to this question. I've been too busy to visit EE for a while.  Thanks for the points.

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode ( They will have you believe that Unicode requires you to use…
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now