Create a spline surface approximating the provided function. :param func: function f(u,v) that will generate (x,y,z) pairs :type func: (float,float) --> (float,float,float) :param N: number of points for discretization in one direction :param start: starting
(
self: T,
func: Callable[[float, float], VectorLike],
N: int = 20,
start: float = 0,
stop: float = 1,
tol: float = 1e-2,
minDeg: int = 1,
maxDeg: int = 6,
smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1),
)
| 1983 | return self.newObject([rv_w if makeWire else e]) |
| 1984 | |
| 1985 | def parametricSurface( |
| 1986 | self: T, |
| 1987 | func: Callable[[float, float], VectorLike], |
| 1988 | N: int = 20, |
| 1989 | start: float = 0, |
| 1990 | stop: float = 1, |
| 1991 | tol: float = 1e-2, |
| 1992 | minDeg: int = 1, |
| 1993 | maxDeg: int = 6, |
| 1994 | smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), |
| 1995 | ) -> T: |
| 1996 | """ |
| 1997 | Create a spline surface approximating the provided function. |
| 1998 | |
| 1999 | :param func: function f(u,v) that will generate (x,y,z) pairs |
| 2000 | :type func: (float,float) --> (float,float,float) |
| 2001 | :param N: number of points for discretization in one direction |
| 2002 | :param start: starting value of the parameters u,v |
| 2003 | :param stop: final value of the parameters u,v |
| 2004 | :param tol: tolerance used by the approximation algorithm (default: 1e-3) |
| 2005 | :param minDeg: minimum spline degree (default: 1) |
| 2006 | :param maxDeg: maximum spline degree (default: 3) |
| 2007 | :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1)) |
| 2008 | :return: a Workplane object with the current point unchanged |
| 2009 | |
| 2010 | This method might be unstable and may require tuning of the tol parameter. |
| 2011 | |
| 2012 | """ |
| 2013 | |
| 2014 | diff = stop - start |
| 2015 | allPoints = [] |
| 2016 | |
| 2017 | for i in range(N + 1): |
| 2018 | generator = ( |
| 2019 | func(start + diff * i / N, start + diff * j / N) for j in range(N + 1) |
| 2020 | ) |
| 2021 | allPoints.append(self._toVectors(generator, False)) |
| 2022 | |
| 2023 | f = Face.makeSplineApprox( |
| 2024 | allPoints, tol=tol, smoothing=smoothing, minDeg=minDeg, maxDeg=maxDeg |
| 2025 | ) |
| 2026 | |
| 2027 | return self.newObject([f]) |
| 2028 | |
| 2029 | def ellipseArc( |
| 2030 | self: T, |