News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Lines and points

Started by Dr PR, September 17, 2007, 11:32:59 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Dr PR

I would like to see a function that would regenerate an existing line with a defined number of evenly spaced points. All existing points would be removed and a new set of points would be created along the line - in effect the original line would be replaced by the new line.

You can do this now:
1. Draw a line/curve.
2. Use "Draw/Tickmark" to place marks evenly spaced along the line.
3. Delete the original line.
4. Connect the ends of the tickmarks to create the new line/curve.
5. Erase the tickmarks.

The "Draw/Surface Connect" operation works best if the guide lines have the same number of points. I have recently repeated this process hundreds of times while trying to create complex surface grids. Just being able to select a line and change the number of points with a single operation would make the process of generating surfaces a lot easier.

Note: the Tickmark command sets n+1 points, where n = the number of "sections" on the line. It would be nice if the "points in a line" command (and the Tickmark command as well) let us set the number of points/marks we want, and not the number of sections.
DesignCAD user since 1987

prl

#1
Quote from: Dr PR on September 17, 2007, 11:32:59 AM
You can do this now:
1. Draw a line/curve.
2. Use "Draw/Tickmark" to place marks evenly spaced along the line.
3. Delete the original line.
4. Connect the ends of the tickmarks to create the new line/curve.
5. Erase the tickmarks.

I'm assuming you are aware the curve you are drawing back doesn't necessarily match the original depending on the number of divisions (curve fitting roughness).  Obviously as n divisions gets larger the curves will get closer.



blue  - original curve that was segmented using tickmarks

red -  new curve using tickmarks for curve points.

Dr PR

That is a potential problem, but it is something I can live with. Curves are not precision elements - we really can't control where they go with a great deal of accuracy. So who is to say which curve is correct in your example, blue or red? This is especially true if you are stretching surfaces over the curves. Surfaces have a mind of their own.

However, you get better "fineness of fit" with more points, so it would be nice to be able to select a curve and say "bless you, you now have more points."
DesignCAD user since 1987

bdeck

#3
Hi DrPR,

I'll have to agree with Prl on this one. 

After spending hours creating fair curves to define a fair surface, I could never trust my work to a function that destroys my work.

That's the problem with the trim funcion when applied to a curve. The original curve is eliminated, and a new one of uncertain shape is returned in its place. And the trim point is wrong.

However, what may work best for your needs would be an option in vector convert curve-to-line to set user-defined uniform node spacing.

BTW, I can't find a case where point spacing has any impact on surface connect. When does that happen?

Best Regards,

BD

Dr PR

BD, believe me, I do share your mistrust! Save the file before experimenting!

Actually, there are two cases I know of where point spacing has significant effects.

1. One surface. If the surface has two interacting curves to create a hyperbolic surface or "saddle" and the resultant main axis of the surface is also curved the surface can get pretty weird. Think of a torus with bumps on it. Between the bumps are hyperbolic surfaces, and these are curved around the radius of the torus. If the bumps are large you will get severe stretching of the surface at the base of the bumps on the inside of the torus. This appears as waves or folds in the surface. Worst case happens when the bumps are more like bubbles with a radius approaching the cross-section radius of the torus. The surface between the bump and the torus curves sharply.

Often you can reduce or eliminate these folds by adding new points to the original curves or just by repositioning the existing points. In this case uniform point spacing can cause problems. The problem is greatest when the original curves differ in length greatly. This happens when the curves are like elevation curves on a topo map. Think of a series of curves covering only 1/4 of the circumference of a hill. Higher elevation arcs are shorter than those at lower elevation. If the curves are smooth the surface works OK. Now add a bump on the side of the hill and look at the effect upon facets along the lines that stretch over the bump. DesignCAD works from the starting ends of the curves and on the side of the bump away from the starting end the facets weave all over the place. Make the bump big enough and eventually the surface will fold back upon itself between curves. Often you can correct this by repositioning the original points along the curves so they are spaced farther apart where there is little curvature and closely together at the sharpest bends. It takes a lot of experimentation, and it helps if you make the plane of the curves your working plane.

The Surface Connect dialog box has a "Use original points" check box. I once thought that this implied that the function does not use the original points if this box is not checked. Maybe so, but the position of those points does matter! Worse still, the point order in which the original lines were created is very important. Draw one curve from left to right, another from right to left, and a third from left to right, and try to stretch a surface between them. In many (all?) cases the resulting surface looks like a wad of paper. I'm not sure what adding points does to the point order.

2. Two adjacent surfaces. If you want adjoining surfaces to fit seamlessly you need the same number of points/sections along the joining edges. Furthermore, the fit is best of the point spacing is the same. The best way to accomplish this is to use the same curve at the adjoining edges.

You can fudge this in several ways. If one surface edge has twice as many points as the other, you can manually move the intermediate points on one edge to the midpoints of the edges of facets on the adjacent surface - a lot of work, especially if you have to regenerate the surface many times.
DesignCAD user since 1987

bdeck

#5
Do I understand correctly that you are using polylines instead of curves for your stations when executing the surface connect command?

(That would be understandable, since DC's internal interpolation error misses curves and arcs by a mile when constructing grids in surface connect.

Jerry, please give this top priority.) 

BD

Dr PR

bdeck,

I use the curve (C) function to set the points for curves I use to define surfaces. Polylines have always seemed a bit strange to me. The biggest problem (when I last used polylines in the 1980s or early 1990s) was that no two programs defined polylines the same way. Consider the point sets, one a point on the line and the other a point to define the tangency. Some programs would use the first point in a data set to be the point on a line and other programs would use the first point as the tangent. Lines that looked like a "C" in one program drew as an "S" in another. It was virtually impossible to transfer drawings with polylines correctly from one application to another. Simple curves almost always transfer correctly.

DesignCAD may "miss curves and arcs by a mile" in Surface Connect IF you do not set the "Use original points" option. I have found that this option causes the surface to fit much better to the original curves. However, it sometimes has the undesirable side effect of causing the facets to be twisted wildly. Even so, the surface can be surprisingly smooth.

If the surface is still not what you want there are two things you can do to tame it:

1. Add more control curves. The easiest way I have found is to stretch a surface over existing curves and set the number of intermediate breaks to the number of new curves you want to add between the existing curves. Then use gravity snap to draw new curves along the lines of the intermediate facets in the surface. Note: these new lines may be misaligned if the surface is badly warped, so you will have to edit them (patience is a virtue) to bend them into the correct shape to make the surface work correctly.

2. Add more points to existing lines, especially in areas where the curve seems to have a mind of its own. Note: adding points may do unpredictable things to the "point order" that DesignCAD uses to determine connections between facets in the surface (seems like a bug to me). Sometimes the only solution is to redraw the line and manually set the point order. This is where tickmarks are handy. Select the curve, set the desired number of tickmarks, delete the original curve (to get rid of interfering points), redraw the curve at the ends of the tickmarks, and delete the tickmarks. It is a lot of work, but if you are persistent you can force the surface into very complex shapes.


prl,

I have been thinking about the example you posted showing how the curve changes when it is edited. This is a perfect example of where adding more points to the curve will solve the problem. Where a curve is drawn around a point depends upon the positions of several points to either side. Change these distant points and the curve changes, just as the red curve in your example is different from the original blue curve. If you double (or triple) the number of points in the blue curve before making the change the resulting new curve will be much closer to the original.

Before digital topo maps were available I used to digitize the USGS maps by hand, using a digitizing tablet. The resulting data point sets were imported into DesignCAD to create the digital topo maps. This exercise gave me an intimate understanding of where points are needed to make curves fit correctly. Simply stated, the more curvature to the line the more points that are needed to control it. You MUST set a point at each inflection point in the curve. Additional points are needed between inflection points if the curve bends very much, but if positioned correctly only one intermediate point is necessary. In a way it is doing the same thing with ordinary curves that the tangent points do in polylines.

One last thing. When using tickmarks to add points to a curve you don't have to set new points at every tickmark. They are just guides to help you set points along the existing curve, and you don't need to place additional points in (nearly) straight parts of the curve. However, if the curve is to be used with Surface Connect you really should try to make the number of points in each curve equal, and in the same order. Then you can set the "Use original points" and "Retain original point order" to have the best control over the surface.

****

If anyone has a better way to control surfaces, I really would like to know. The way I do it is VERY time consuming, and often quite frustrating. But, it works.
DesignCAD user since 1987

bdeck

#7
Quote from: Dr PR on September 18, 2007, 03:11:05 PM
Curves are not precision elements - we really can't control where they go with a great deal of accuracy.

Actually curves are quite precise and repeatable. A cubic spline is a cubic spline, except that DC, like most others, uses forward and backward fairing, so that moving a single point will afffect the shape of the entire spline.

That is not a bug, and it is not the cause of the present problem, but it is an awkward choice for a cad program. Moving a point on a cubic spline  without that feature would have no effect beyonnd 2 nodes away. The simpler spline would require slightly more manual fairing (more points), but it would compute faster and be easier to edit.

You are correct that it is hard to predict where the curve will fall when we first put our points on the virtual vellum. But once we set enough points to define the curve to our satisfaction, we should not have to add more points to compensate for deficiencies in the software.  DC's inability to calculate an intercept to a curve after all these years is troubling.

No matter how many points we add to our curves, the surfaces that result will still be wrong until this bug gets fixed.

Regards

BD


PS:   

Heres a possible improvement for the interim.

Add enough points to your curves to reduce DC's interpolation error to a tolerable level.

Next write a hammer macro that works on curves, and that gives you control over the radius and severity of the hammer effect. When you move one point in this new hammer mode, the neighbors will move with it in a defined manner, so editing time will be reduced. Points on neighboring curves, if selected, should also be afffected by the macro.

I'd use it.

BD






bdeck

#8
Hi Dr Pr,

I tried drawing a volcano from topographical lines, and saw the need to align points as you mentioned.

Heres a modification of an old pointwalker macro i used to highlight the first point of each selected entity.

For any that are out of alignment, I either move the first point or redraw the entire curve, snapping to existing control points.

To examine point order o any one curve, the APW macro is in the upload area.

Perhaps what dc needs is a least squares function to do this alignment automatically.

Regards,
BD



' APW2.d3m    POINTWALKER 2
' Highlights the first point of each selected entity
' Select one or more entities, then run the macro.
' Entity type is displayed in the status bar.

dim entno(1000)

ne=sys(80)   ' look for selected entities
d=0
if ne =0 then end   ' if no entities are selected then end 

for i=1 to ne
   getselect i,entno(i)
next i

>deselect    ' optional
{
}

for i=1 to ne

GETATTR entno(i), type
entity entno(i)
pointval x, y, z, 1


>PointMark
{
<Type 1
<Size 100        ' change this if needed
<Color 0,255,0
<Pointxyz [x, y, z]
}

print i," of  ",ne," is entity type ",type
message "next point"
>EraseLast
{
}

next i

cleanup:

>PointMark  ' reset color
{
<Type 1
<Size 0
<Color 0,0,0         ' change this if needed
<Pointxyz [x, y, z]
}

>EraseLast
{
}

for i=1 to ne   '  optional reselect
GETATTR entno(i), t
PUTATTR entno(i), t,1
next i

sys(1)=0
regen


end