@@ -56,6 +56,7 @@ def __init__(self):
56
56
self ._curve_points = []
57
57
self ._dimension = 3 # 3D coordinates
58
58
self ._rational = False
59
+ self ._vis_component = None
59
60
60
61
@property
61
62
def order (self ):
@@ -177,6 +178,53 @@ def curvepts(self):
177
178
"""
178
179
return self ._curve_points
179
180
181
+ @property
182
+ def vis (self ):
183
+ """ Visualization component.
184
+
185
+ .. note:: The visualization component is completely optional to use.
186
+
187
+ :getter: Gets the visualization component
188
+ :setter: Sets the visualization component
189
+ :type: float
190
+ """
191
+ return self ._vis_component
192
+
193
+ @vis .setter
194
+ def vis (self , value ):
195
+ if not isinstance (value , VisBase .VisAbstract ):
196
+ warnings .warn ("Visualization component is NOT an instance of VisABC" )
197
+ return
198
+ self ._vis_component = value
199
+
200
+ # Runs visualization component to render the surface
201
+ def render (self , cpcolor = "blue" , curvecolor = "black" ):
202
+ """ Renders the curve using the loaded visualization component
203
+
204
+ The visualization component must be set using :py:attr:`~vis` property before calling this method.
205
+
206
+ :param cpcolor: Color of the control points polygon
207
+ :type cpcolor: str
208
+ :param curvecolor: Color of the curve
209
+ :type curvecolor: str
210
+ :return: None
211
+ """
212
+ if not self ._vis_component :
213
+ warnings .warn ("No visualization component has set" )
214
+ return
215
+
216
+ # Check all parameters are set
217
+ self ._check_variables ()
218
+
219
+ # Check if the surface has been evaluated
220
+ if not self ._curve_points :
221
+ self .evaluate ()
222
+
223
+ # Run the visualization component
224
+ self ._vis_component .add (self .ctrlpts , "Control Points" , cpcolor )
225
+ self ._vis_component .add (self .curvepts , "Curve" , curvecolor )
226
+ self ._vis_component .render ()
227
+
180
228
# Cleans up the control points
181
229
def _reset_ctrlpts (self ):
182
230
if self ._control_points :
0 commit comments