Changeset 2318 for trunk/packages
- Timestamp:
- Jul 23, 2011, 10:22:26 AM (13 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpStreamlines.cpp
r2317 r2318 14 14 #include <vtkCellArray.h> 15 15 #include <vtkPolyLine.h> 16 #include <vtkRegularPolygonSource.h> 16 17 #include <vtkPointData.h> 17 18 #include <vtkCellData.h> … … 213 214 seed->SetVerts(cells); 214 215 215 TRACE("Seed points: %d", seed->GetNumberOf Verts());216 TRACE("Seed points: %d", seed->GetNumberOfPoints()); 216 217 217 218 _streamTracer->SetMaximumPropagation(maxBound); … … 314 315 seed->SetVerts(cells); 315 316 316 TRACE("Seed points: %d", seed->GetNumberOf Verts());317 TRACE("Seed points: %d", seed->GetNumberOfPoints()); 317 318 vtkSmartPointer<vtkDataSet> oldSeed; 318 319 if (_streamTracer->GetSource() != NULL) { … … 330 331 331 332 /** 332 * \brief Use randomly distributed seed points333 * \brief Use seed points along a line 333 334 * 334 335 * \param[in] numPoints Number of random seed points to generate … … 350 351 } 351 352 352 srand((unsigned int)time(NULL));353 353 polyline->GetPointIds()->SetNumberOfIds(numPoints); 354 354 for (int i = 0; i < numPoints; i++) { … … 366 366 seed->SetLines(cells); 367 367 368 TRACE("Seed points: %d", seed->GetNumberOf Verts());368 TRACE("Seed points: %d", seed->GetNumberOfPoints()); 369 369 vtkSmartPointer<vtkDataSet> oldSeed; 370 370 if (_streamTracer->GetSource() != NULL) { … … 378 378 379 379 _seedMapper->SetInput(seed); 380 } 381 } 382 383 /** 384 * \brief Use seed points from an n-sided polygon 385 * 386 * \param[in] numPoints Number of random seed points to generate 387 */ 388 void Streamlines::setSeedToPolygon(double center[3], 389 double normal[3], 390 double radius, 391 int numSides) 392 { 393 if (_streamTracer != NULL) { 394 // Set up seed source object 395 vtkSmartPointer<vtkRegularPolygonSource> seed = vtkSmartPointer<vtkRegularPolygonSource>::New(); 396 397 seed->SetCenter(center); 398 seed->SetNormal(normal); 399 seed->SetRadius(radius); 400 seed->SetNumberOfSides(numSides); 401 seed->GeneratePolygonOn(); 402 403 TRACE("Seed points: %d", numSides); 404 vtkSmartPointer<vtkDataSet> oldSeed; 405 if (_streamTracer->GetSource() != NULL) { 406 oldSeed = _streamTracer->GetSource(); 407 } 408 409 _streamTracer->SetSourceConnection(seed->GetOutputPort()); 410 if (oldSeed != NULL) { 411 oldSeed->SetPipelineInformation(NULL); 412 } 413 414 _seedMapper->SetInputConnection(seed->GetOutputPort()); 380 415 } 381 416 } -
trunk/packages/vizservers/vtkvis/RpStreamlines.h
r2317 r2318 46 46 47 47 void setSeedToRake(double start[3], double end[3], int numPoints); 48 49 void setSeedToPolygon(double center[3], double normal[3], 50 double radius, int numSides); 48 51 49 52 void setMaxPropagation(double length); -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2317 r2318 3123 3123 } 3124 3124 3125 /** 3126 * \brief Set the streamlines seed to points distributed randomly inside 3127 * cells of DataSet 3128 */ 3125 3129 void Renderer::setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints) 3126 3130 { … … 3147 3151 } 3148 3152 3153 /** 3154 * \brief Set the streamlines seed to points along a line 3155 */ 3149 3156 void Renderer::setStreamlinesSeedToRake(const DataSetId& id, double start[3], double end[3], int numPoints) 3150 3157 { … … 3166 3173 do { 3167 3174 itr->second->setSeedToRake(start, end, numPoints); 3175 } while (doAll && ++itr != _streamlines.end()); 3176 3177 _needsRedraw = true; 3178 } 3179 3180 /** 3181 * \brief Set the streamlines seed to vertices of an n-sided polygon 3182 */ 3183 void Renderer::setStreamlinesSeedToPolygon(const DataSetId& id, 3184 double center[3], double normal[3], 3185 double radius, int numSides) 3186 { 3187 StreamlinesHashmap::iterator itr; 3188 3189 bool doAll = false; 3190 3191 if (id.compare("all") == 0) { 3192 itr = _streamlines.begin(); 3193 doAll = true; 3194 } else { 3195 itr = _streamlines.find(id); 3196 } 3197 if (itr == _streamlines.end()) { 3198 ERROR("Streamlines not found: %s", id.c_str()); 3199 return; 3200 } 3201 3202 do { 3203 itr->second->setSeedToPolygon(center, normal, radius, numSides); 3168 3204 } while (doAll && ++itr != _streamlines.end()); 3169 3205 … … 3397 3433 lut->DeepCopy(cmap->getLookupTable()); 3398 3434 3435 #if 0 3399 3436 if (_useCumulativeRange) { 3400 3437 lut->SetRange(_cumulativeDataRange); … … 3406 3443 } 3407 3444 } 3445 #endif 3408 3446 3409 3447 itr->second->setLookupTable(lut); -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r2317 r2318 358 358 Streamlines *getStreamlines(const DataSetId& id); 359 359 360 void setStreamlinesSeedToDataSet(const DataSetId& id, vtkDataSet *seed);361 362 360 void setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints); 363 361 364 362 void setStreamlinesSeedToRake(const DataSetId& id, double start[3], double end[3], int numPoints); 363 364 void setStreamlinesSeedToPolygon(const DataSetId& id, double center[3], double normal[3], 365 double radius, int numSides); 365 366 366 367 void setStreamlinesLength(const DataSetId& id, double length); -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r2317 r2318 2490 2490 2491 2491 static int 2492 StreamlinesSeedPolygonOp(ClientData clientData, Tcl_Interp *interp, int objc, 2493 Tcl_Obj *const *objv) 2494 { 2495 double center[3], normal[3], radius; 2496 int numSides; 2497 for (int i = 0; i < 3; i++) { 2498 if (Tcl_GetDoubleFromObj(interp, objv[3+i], ¢er[i]) != TCL_OK) { 2499 return TCL_ERROR; 2500 } 2501 if (Tcl_GetDoubleFromObj(interp, objv[6+i], &normal[i]) != TCL_OK) { 2502 return TCL_ERROR; 2503 } 2504 } 2505 if (Tcl_GetDoubleFromObj(interp, objv[9], &radius) != TCL_OK) { 2506 return TCL_ERROR; 2507 } 2508 if (Tcl_GetIntFromObj(interp, objv[10], &numSides) != TCL_OK) { 2509 return TCL_ERROR; 2510 } 2511 if (objc == 12) { 2512 const char *name = Tcl_GetString(objv[11]); 2513 g_renderer->setStreamlinesSeedToPolygon(name, center, normal, radius, numSides); 2514 } else { 2515 g_renderer->setStreamlinesSeedToPolygon("all", center, normal, radius, numSides); 2516 } 2517 return TCL_OK; 2518 } 2519 2520 static int 2492 2521 StreamlinesSeedRakeOp(ClientData clientData, Tcl_Interp *interp, int objc, 2493 2522 Tcl_Obj *const *objv) … … 2551 2580 static Rappture::CmdSpec streamlinesSeedOps[] = { 2552 2581 {"color", 1, StreamlinesSeedColorOp, 6, 7, "r g b ?dataSetName?"}, 2582 {"polygon", 1, StreamlinesSeedPolygonOp, 11, 12, "centerX centerY centerZ normalX normalY normalZ radius numSides ?dataSetName?"}, 2553 2583 {"rake", 3, StreamlinesSeedRakeOp, 10, 11, "startX startY startZ endX endY endZ numPoints ?dataSetName?"}, 2554 2584 {"random", 3, StreamlinesSeedRandomOp, 4, 5, "numPoints ?dataSetName?"}, -
trunk/packages/vizservers/vtkvis/protocol.txt
r2317 r2318 169 169 degrees offset from normal orientation 170 170 streamlines seed color <r> <g> <b> <?datasetName?> 171 streamlines seed polygon <centerX> <centerY> <centerZ> <normalX> <normalY> <normalZ> <radius> <numSides> <?dataSetName?> 171 172 streamlines seed rake <startX> <startY> <startZ> <endX> <endY> <endZ> <numPoints> <?datasetName?> 172 173 streamlines seed random <numPoints> <?datasetName?>
Note: See TracChangeset
for help on using the changeset viewer.