NURBS of degree 1 "rounded" corners problem

Hi,

I am drawing a NURBS of degree 1 forming a crenellated shape (see shape.png) and some of the corners, that should be sharp, almost right angle, are sort of rounded, like if the tip was cut (see corner.png).

Here is the DRAW code to reproduce:

pload ALL
bsplinecurve c 1 23 \
0 2 \
6.8 1 \
8.9 1 \
9.95 1 \
14.15 1 \
15.2 1 \
19.4 1 \
20.45 1 \
24.65 1 \
25.7 1 \
29.9 1 \
30.95 1 \
35.15 1 \
36.2 1 \
40.4 1 \
41.45 1 \
45.65 1 \
46.7 1 \
50.9 1 \
51.95 1 \
54.6 1 \
60.35 1 \
98.7 2 \
21 6.8 0 1 \
21 0 0 1 \
23.1 0 0 1 \
23.1 1.05 0 1 \
27.3 1.05 0 1 \
27.3 0 0 1 \
31.5 0 0 1 \
31.5 1.05 0 1 \
35.7 1.05 0 1 \
35.7 0 0 1 \
39.9 0 0 1 \
39.9 1.05 0 1 \
44.1 1.05 0 1 \
44.1 0 0 1 \
48.3 0 0 1 \
48.3 1.05 0 1 \
52.5 1.05 0 1 \
52.5 0 0 1 \
56.7 0 0 1 \
56.7 1.05 0 1 \
59.35 1.05 0 1 \
59.35 6.8 0 1 \
21 6.8 0 1
mkedge e c
wire w e
vdisplay w
vfit

I've also tried with uniformly spaced knots:

pload ALL
bsplinecurve c 1 23 \
0 2 \
1 1 \
2 1 \
3 1 \
4 1 \
5 1 \
6 1 \
7 1 \
8 1 \
9 1 \
10 1 \
11 1 \
12 1 \
13 1 \
14 1 \
15 1 \
16 1 \
17 1 \
18 1 \
19 1 \
20 1 \
21 1 \
22 2 \
21 6.8 0 1 \
21 0 0 1 \
23.1 0 0 1 \
23.1 1.05 0 1 \
27.3 1.05 0 1 \
27.3 0 0 1 \
31.5 0 0 1 \
31.5 1.05 0 1 \
35.7 1.05 0 1 \
35.7 0 0 1 \
39.9 0 0 1 \
39.9 1.05 0 1 \
44.1 1.05 0 1 \
44.1 0 0 1 \
48.3 0 0 1 \
48.3 1.05 0 1 \
52.5 1.05 0 1 \
52.5 0 0 1 \
56.7 0 0 1 \
56.7 1.05 0 1 \
59.35 1.05 0 1 \
59.35 6.8 0 1 \
21 6.8 0 1
mkedge e c
wire w e
vdisplay w
vfit

Is there some sort of discretization factor or parameter I could set to fix this? Or is the problem somewhere else?

Attachments: 
Mikhail Sazonov's picture

It is just discretisation problem of C0 curves and surfaces. The algorithm does not treat bspline knots in any special manner, so it can skip them in the result polygon. Is it really necessary for you to encode the whole contour with one curve? In OCCT, the algorithms better deal with piece-wise C1-continuous shapes. In your case, you can construct the target wire using the following draw command:

polyline w x1 y1 z1 x2 y2 z2 ... x1 y1 z1

jerome caucat's picture

Thanks Mikhail Sazonov,

> Is it really necessary for you to encode the whole contour with one curve?

No, the end result is a wire. Building polylines instead of NURBS for all NURBS of degree 1 was my last resort solution anyway, I need something generic, I was just wondering if this is not going to backfire at some point. I'll do that and see how it works.