Control Points Manager¶
The control_points
module provides helper functions for managing control points. It is a better alternative to
the compatibility module for managing control points. Please refer to the following
class references for more details.
Class Reference¶
-
class
geomdl.control_points.
AbstractManager
(*args, **kwargs)¶ Bases:
object
Abstract base class for control points manager classes.
Control points manager class provides an easy way to set control points without knowing the internal data structure of the geometry classes. The manager class is initialized with the number of control points in all parametric dimensions.
All classes extending this class should implement the following methods:
find_index
This class provides the following properties:
This class provides the following methods:
-
ctrlpts
¶ Control points.
Please refer to the wiki for details on using this class member.
Getter: Gets the control points Setter: Sets the control points
-
find_index
(*args)¶ Finds the array index from the given parametric positions.
Note
This is an abstract method and it must be implemented in the subclass.
-
get_ctrlpt
(*args)¶ Gets the control point from the given location in the array.
-
get_ptdata
(dkey, *args)¶ Gets the data attached to the control point.
Parameters: - dkey – key of the attachment dictionary
- dkey – str
-
reset
()¶ Resets/initializes the internal control points array.
-
set_ctrlpt
(pt, *args)¶ Puts the control point to the given location in the array.
Parameters: pt (list, tuple) – control point
-
set_ptdata
(adct, *args)¶ Attaches the data to the control point.
Parameters: - adct – attachment dictionary
- adct – dict
-
class
geomdl.control_points.
CurveManager
(*args, **kwargs)¶ Bases:
geomdl.control_points.AbstractManager
Curve control points manager.
Control points manager class provides an easy way to set control points without knowing the internal data structure of the geometry classes. The manager class is initialized with the number of control points in all parametric dimensions.
B-spline curves are defined in one parametric dimension. Therefore, this manager class should be initialized with a single integer value.
# Assuming that the curve has 10 control points manager = CurveManager(10)
Getting the control points:
# Number of control points in all parametric dimensions size_u = spline.ctrlpts_size_u # Generate control points manager cpt_manager = control_points.SurfaceManager(size_u) cpt_manager.ctrlpts = spline.ctrlpts # Control points array to be used externally control_points = [] # Get control points from the spline geometry for u in range(size_u): pt = cpt_manager.get_ctrlpt(u) control_points.append(pt)
Setting the control points:
# Number of control points in all parametric dimensions size_u = 5 # Create control points manager points = control_points.SurfaceManager(size_u) # Set control points for u in range(size_u): # 'pt' is the control point, e.g. [10, 15, 12] points.set_ctrlpt(pt, u, v) # Create spline geometry curve = BSpline.Curve() # Set control points curve.ctrlpts = points.ctrlpts
-
ctrlpts
¶ Control points.
Please refer to the wiki for details on using this class member.
Getter: Gets the control points Setter: Sets the control points
-
find_index
(*args)¶ Finds the array index from the given parametric positions.
Note
This is an abstract method and it must be implemented in the subclass.
-
get_ctrlpt
(*args)¶ Gets the control point from the given location in the array.
-
get_ptdata
(dkey, *args)¶ Gets the data attached to the control point.
Parameters: - dkey – key of the attachment dictionary
- dkey – str
-
reset
()¶ Resets/initializes the internal control points array.
-
set_ctrlpt
(pt, *args)¶ Puts the control point to the given location in the array.
Parameters: pt (list, tuple) – control point
-
set_ptdata
(adct, *args)¶ Attaches the data to the control point.
Parameters: - adct – attachment dictionary
- adct – dict
-
-
class
geomdl.control_points.
SurfaceManager
(*args, **kwargs)¶ Bases:
geomdl.control_points.AbstractManager
Surface control points manager.
Control points manager class provides an easy way to set control points without knowing the internal data structure of the geometry classes. The manager class is initialized with the number of control points in all parametric dimensions.
B-spline surfaces are defined in one parametric dimension. Therefore, this manager class should be initialized with two integer values.
# Assuming that the surface has size_u = 5 and size_v = 7 control points manager = SurfaceManager(5, 7)
Getting the control points:
# Number of control points in all parametric dimensions size_u = spline.ctrlpts_size_u size_v = spline.ctrlpts_size_v # Generate control points manager cpt_manager = control_points.SurfaceManager(size_u, size_v) cpt_manager.ctrlpts = spline.ctrlpts # Control points array to be used externally control_points = [] # Get control points from the spline geometry for u in range(size_u): for v in range(size_v): pt = cpt_manager.get_ctrlpt(u, v) control_points.append(pt)
Setting the control points:
# Number of control points in all parametric dimensions size_u = 5 size_v = 3 # Create control points manager points = control_points.SurfaceManager(size_u, size_v) # Set control points for u in range(size_u): for v in range(size_v): # 'pt' is the control point, e.g. [10, 15, 12] points.set_ctrlpt(pt, u, v) # Create spline geometry surf = BSpline.Surface() # Set control points surf.ctrlpts = points.ctrlpts
-
ctrlpts
¶ Control points.
Please refer to the wiki for details on using this class member.
Getter: Gets the control points Setter: Sets the control points
-
find_index
(*args)¶ Finds the array index from the given parametric positions.
Note
This is an abstract method and it must be implemented in the subclass.
-
get_ctrlpt
(*args)¶ Gets the control point from the given location in the array.
-
get_ptdata
(dkey, *args)¶ Gets the data attached to the control point.
Parameters: - dkey – key of the attachment dictionary
- dkey – str
-
reset
()¶ Resets/initializes the internal control points array.
-
set_ctrlpt
(pt, *args)¶ Puts the control point to the given location in the array.
Parameters: pt (list, tuple) – control point
-
set_ptdata
(adct, *args)¶ Attaches the data to the control point.
Parameters: - adct – attachment dictionary
- adct – dict
-
-
class
geomdl.control_points.
VolumeManager
(*args, **kwargs)¶ Bases:
geomdl.control_points.AbstractManager
Volume control points manager.
Control points manager class provides an easy way to set control points without knowing the internal data structure of the geometry classes. The manager class is initialized with the number of control points in all parametric dimensions.
B-spline volumes are defined in one parametric dimension. Therefore, this manager class should be initialized with there integer values.
# Assuming that the volume has size_u = 5, size_v = 12 and size_w = 3 control points manager = VolumeManager(5, 12, 3)
Gettting the control points:
# Number of control points in all parametric dimensions size_u = spline.ctrlpts_size_u size_v = spline.ctrlpts_size_v size_w = spline.ctrlpts_size_w # Generate control points manager cpt_manager = control_points.SurfaceManager(size_u, size_v, size_w) cpt_manager.ctrlpts = spline.ctrlpts # Control points array to be used externally control_points = [] # Get control points from the spline geometry for u in range(size_u): for v in range(size_v): for w in range(size_w): pt = cpt_manager.get_ctrlpt(u, v, w) control_points.append(pt)
Setting the control points:
# Number of control points in all parametric dimensions size_u = 5 size_v = 3 size_w = 2 # Create control points manager points = control_points.VolumeManager(size_u, size_v, size_w) # Set control points for u in range(size_u): for v in range(size_v): for w in range(size_w): # 'pt' is the control point, e.g. [10, 15, 12] points.set_ctrlpt(pt, u, v, w) # Create spline geometry volume = BSpline.Volume() # Set control points volume.ctrlpts = points.ctrlpts
-
ctrlpts
¶ Control points.
Please refer to the wiki for details on using this class member.
Getter: Gets the control points Setter: Sets the control points
-
find_index
(*args)¶ Finds the array index from the given parametric positions.
Note
This is an abstract method and it must be implemented in the subclass.
-
get_ctrlpt
(*args)¶ Gets the control point from the given location in the array.
-
get_ptdata
(dkey, *args)¶ Gets the data attached to the control point.
Parameters: - dkey – key of the attachment dictionary
- dkey – str
-
reset
()¶ Resets/initializes the internal control points array.
-
set_ctrlpt
(pt, *args)¶ Puts the control point to the given location in the array.
Parameters: pt (list, tuple) – control point
-
set_ptdata
(adct, *args)¶ Attaches the data to the control point.
Parameters: - adct – attachment dictionary
- adct – dict
-