Skip to content

Commit bda6f4c

Browse files
committed
swith to nv and nu
1 parent 370d9ae commit bda6f4c

File tree

8 files changed

+60
-14
lines changed

8 files changed

+60
-14
lines changed

docs/examples/surface_from_meshgrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
for col in zip(* surface.points):
4141
view.add(Polyline(row), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.3, 0.3, 0.3))
4242

43-
view.add(surface.to_mesh(u=100, v=50))
43+
view.add(surface.to_mesh(nu=100, nv=50))
4444

4545
view.run()

docs/examples/surface_from_parameters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
surface = NurbsSurface.from_parameters(
2525
points=points,
2626
weights=weights,
27-
u_knots=[0.0, 1/9, 2/9, 3/9, 4/9, 5/9, 6/9, 7/9, 8/9, 1.0],
27+
u_knots=[1.0, 1 + 1/9, 1 + 2/9, 1 + 3/9, 1 + 4/9, 1 + 5/9, 1 + 6/9, 1 + 7/9, 1 + 8/9, 2.0],
2828
v_knots=[0.0, 1/9, 2/9, 3/9, 4/9, 5/9, 6/9, 7/9, 8/9, 1.0],
2929
u_mults=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
3030
v_mults=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
@@ -46,6 +46,6 @@
4646
for col in zip(* surface.points):
4747
view.add(Polyline(col), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.3, 0.3, 0.3))
4848

49-
view.add(surface.to_mesh(u=50))
49+
view.add(surface.to_mesh())
5050

5151
view.run()

docs/examples/surface_from_points.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
for col in zip(* surface.points):
2727
view.add(Polyline(col), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.3, 0.3, 0.3))
2828

29-
view.add(surface.to_mesh(u=50))
29+
view.add(surface.to_mesh(nu=100))
3030

3131
view.run()

docs/examples/surface_intersections_with_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
for x in intersections:
5858
view.add(Line(base, base + (x - base).scaled(1.2)), linewidth=1, color=(0, 0, 1))
5959

60-
view.add(surface.to_mesh(u=50), show_edges=False)
60+
view.add(surface.to_mesh(), show_edges=False)
6161

6262
view.run()

docs/examples/surface_jsondata.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
surface = NurbsSurface.from_points(points=points)
1414

15-
print(surface)
16-
1715
# ==============================================================================
1816
# JSON Data
1917
# ==============================================================================
@@ -24,18 +22,23 @@
2422

2523
other = NurbsSurface.from_jsonstring(string)
2624

25+
print(surface == other)
26+
2727
# ==============================================================================
2828
# Visualisation
2929
# ==============================================================================
3030

3131
view = App()
3232

33-
for row in other.points:
34-
view.add(Polyline(row), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.3, 0.3, 0.3))
33+
u = surface.u_isocurve(0.5 * sum(surface.u_domain))
34+
v = surface.v_isocurve(0.5 * sum(surface.v_domain))
35+
36+
view.add(Polyline(u.locus()), linewidth=1, linecolor=(0.3, 0.3, 0.3))
37+
view.add(Polyline(v.locus()), linewidth=1, linecolor=(0.3, 0.3, 0.3))
3538

36-
for col in zip(* other.points):
37-
view.add(Polyline(col), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.3, 0.3, 0.3))
39+
for curve in surface.boundary():
40+
view.add(Polyline(curve.locus()), linewidth=2, linecolor=(0, 0, 0))
3841

39-
view.add(other.to_mesh(u=50), show_edges=False)
42+
view.add(other.to_mesh(), show_edges=False)
4043

4144
view.run()

docs/examples/surface_obb.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from math import radians
2+
from compas.geometry import Translation, Rotation
3+
from compas.geometry import Point, Polyline
4+
from compas_occ.geometry import NurbsSurface
5+
6+
from compas_view2.app import App
7+
8+
points = [
9+
[Point(0, 0, 0), Point(1, 0, 0), Point(2, 0, 0), Point(3, 0, 0), Point(4, 0, 0)],
10+
[Point(0, 1, 0), Point(1, 1, 2), Point(2, 1, 2), Point(3, 1, 0), Point(4, 1, 0)],
11+
[Point(0, 2, 0), Point(1, 2, 2), Point(2, 2, 2), Point(3, 2, 0), Point(4, 2, 0)],
12+
[Point(0, 3, 0), Point(1, 3, 0), Point(2, 3, 0), Point(3, 3, 0), Point(4, 3, 0)],
13+
]
14+
15+
surface = NurbsSurface.from_points(points=points)
16+
17+
T = Translation.from_vector([0, -1.5, 0])
18+
R = Rotation.from_axis_and_angle([0, 0, 1], radians(45))
19+
20+
surface.transform(R * T)
21+
22+
# ==============================================================================
23+
# OBB
24+
# ==============================================================================
25+
26+
box = surface.obb()
27+
28+
# ==============================================================================
29+
# Visualisation
30+
# ==============================================================================
31+
32+
view = App()
33+
34+
for row in surface.points:
35+
view.add(Polyline(row), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(1.0, 0, 0))
36+
37+
for col in zip(* surface.points):
38+
view.add(Polyline(col), linewidth=2, linecolor=(0, 1.0, 0))
39+
40+
view.add(surface.to_mesh())
41+
view.add(box, show_faces=False)
42+
43+
view.run()

docs/examples/surface_random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@
3434
for col in zip(* surface.points):
3535
view.add(Polyline(col), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.3, 0.3, 0.3))
3636

37-
view.add(surface.to_mesh(u=100, v=50))
37+
view.add(surface.to_mesh(nu=100, nv=50))
3838

3939
view.run()

docs/examples/surface_spacepoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
for col in zip(* surface.points):
3434
view.add(Polyline(col), show_points=True, pointsize=20, pointcolor=(1, 0, 0), linewidth=2, linecolor=(0.5, 1.0, 0.5))
3535

36-
view.add(surface.to_mesh(u=50), show_edges=False)
36+
view.add(surface.to_mesh(), show_edges=False)
3737

3838
view.add(Collection(spacepoints))
3939

0 commit comments

Comments
 (0)