compas_brep.surfaces.nurbs
¤
This is an attempt at Pure-Python rational NURBS surface built on scipy.interpolate.BSpline which seems more doable than a pure-Python Brep.
This is a replacement for the compas.geometry.NurbsSurface pluggable but need to be evaluated for completness.
Classes¤
ControlPointGrid
¤
ControlPointGrid(data: list[list[Point]], surface: NurbsSurface | None = None)
A 2-D grid wrapper that supports both grid[i][j] and grid[i, j] indexing.
Modifications through grid[i, j] = point invalidate the parent surface's caches.
- API Reference
NurbsSurface
¤
NurbsSurface(name: str | None = None)
A rational NURBS surface (tensor-product).
Parameters:
-
name(str | None, default:None) –The name of the surface.
-
API Reference
-
compas_brep Classes -
Topology
face ClassesBrepFace Attributesnurbssurface -
Geometry
nurbs ClassesNurbsSurface Methods:
-
-
API Reference
-
compas_brep Classes - Topology
-
Geometry
nurbs ClassesControlPointGrid
-
Attributes¤
points
property
¤
points: ControlPointGrid
2-D grid of control points (nu x nv).
Supports both surface.points[i][j] and surface.points[i, j] indexing.
Methods:¤
frame_at
¤
from_extrusion
classmethod
¤
from_extrusion(curve: NurbsCurve, vector: Vector) -> NurbsSurface
Create a surface by extruding a curve along a vector.
U direction follows the curve, V direction is the extrusion.
Parameters:
-
curve(NurbsCurve) –The profile curve.
-
vector(Vector) –The extrusion direction.
from_fill
classmethod
¤
from_fill(
curve1: NurbsCurve,
curve2: NurbsCurve,
curve3: NurbsCurve | None = None,
curve4: NurbsCurve | None = None,
style: str = "stretch",
) -> NurbsSurface
Create a surface filling between boundary curves.
For 2 curves a ruled surface (linear interpolation) is created. For 4 curves a simplified bilinear Coons patch is created.
Parameters:
-
curve1(NurbsCurve) –First boundary curve.
-
curve2(NurbsCurve) –Second boundary curve (opposite to curve1).
-
curve3(NurbsCurve | None, default:None) –Third boundary curve.
-
curve4(NurbsCurve | None, default:None) –Fourth boundary curve.
-
style(str, default:'stretch') –Fill style (currently only "stretch" is supported).
from_meshgrid
classmethod
¤
from_meshgrid(nu: int = 4, nv: int = 4) -> NurbsSurface
from_parameters
classmethod
¤
from_parameters(
points: list[list[Point]],
weights: list[list[float]],
knots_u: list[float],
knots_v: list[float],
mults_u: list[int],
mults_v: list[int],
degree_u: int,
degree_v: int,
) -> NurbsSurface
Create a NurbsSurface from explicit parameters.
Parameters:
-
points(list[list[Point]]) –2-D grid of control points (nu x nv).
-
weights(list[list[float]]) –2-D grid of weights.
-
knots_u(list[float]) –Unique knot values in U direction.
-
knots_v(list[float]) –Unique knot values in V direction.
-
mults_u(list[int]) –Multiplicities in U direction.
-
mults_v(list[int]) –Multiplicities in V direction.
-
degree_u(int) –Degree in U direction.
-
degree_v(int) –Degree in V direction.
from_points
classmethod
¤
Create a NurbsSurface from a 2-D grid of control points.
Generates clamped uniform knot vectors. Degree is clamped to
min(degree, n_points - 1) in each direction.
Parameters:
isocurve_u
¤
isocurve_u(u: float) -> NurbsCurve
isocurve_v
¤
isocurve_v(v: float) -> NurbsCurve
normal_at
¤
point_at
¤
space_u
¤
Return n+1 uniformly spaced parameters in U domain.
Parameters:
-
n(int, default:10) –Number of intervals.
space_v
¤
Return n+1 uniformly spaced parameters in V domain.
Parameters:
-
n(int, default:10) –Number of intervals.
transform
¤
transform(transformation: Transformation) -> None
Transform all control points in-place.
Parameters:
-
transformation(Transformation) –The transformation to apply.