<div dir="ltr"><div class="gmail_default" style="font-size:small">Jeffery</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small">​I think this is related to the ParametricFunctions. These functions are generated by mapping R² -> R³ and are then triangulated.</div><div class="gmail_default" style="font-size:small">I tried vtkParametricSuperToroid and sometimes the contouring and cutting worked but in some orientations the triangulation failed.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">​If you use a <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">vtkSuperquadricSource</span> e.g:</div><div class="gmail_default" style="font-size:small"><div class="gmail_default">vtkSmartPointer<vtkSuperquadricSource> source = vtkSmartPointer<vtkSuperquadricSource>::New();</div><div class="gmail_default">source->SetCenter(0, 0, 0);</div><div class="gmail_default">source->SetPhiRoundness(1.0);</div><div class="gmail_default">source->SetThetaRoundness(1.0);</div><div class="gmail_default">source->ToroidalOn();</div><div><br></div><div>Everything seems to work Ok.</div><div><br></div><div>Andrew</div></div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>---------- Forwarded message ----------<br>From: Jeffery Lewis <<a href="mailto:jlewis@accuray.com">jlewis@accuray.com</a>><br>To: "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>Cc: <br>Bcc: <br>Date: Fri, 2 Mar 2018 23:46:09 +0000<br>Subject: Re: [vtkusers] Problem with vtkContourTriangulator and vtkPlaneCutter (Jeffery Lewis)<br>Seems like the attachments didn't go through. Here is the code.<br>
<br>
#include <vtkSmartPointer.h><br>
#include <vtkParametricSuperToroid.h><br>
#include <vtkParametricFunctionSource.<wbr>h><br>
#include <vtkSphereSource.h><br>
#include <vtkCamera.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkPolyDataMapper2D.h><br>
#include <vtkDataSetMapper.h><br>
#include <vtkCompositePolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkActor2D.h><br>
#include <vtkPlane.h><br>
#include <vtkCutter.h><br>
#include <vtkPlaneCutter.h><br>
#include <vtkProperty.h><br>
#include <vtkProperty2D.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkMath.h><br>
#include <vtkInteractorStyle.h><br>
#include <vtkInteractorStyleImage.h><br>
#include <vtkTransform.h><br>
#include <vtkContourTriangulator.h><br>
#include <vtkCleanPolyData.h><br>
#include <vtkConeSource.h><br>
#include <vtkCommand.h><br>
#include <vtkSliderWidget.h><br>
#include <vtkSliderRepresentation2D.h><br>
<br>
// Callbacks for the interactions<br>
class SliderCallbackN1 : public vtkCommand {<br>
public:<br>
static SliderCallbackN1 *New() {<br>
return new SliderCallbackN1;<br>
}<br>
virtual void Execute(vtkObject *caller, unsigned long, void*) {<br>
vtkSliderWidget *sliderWidget =<br>
reinterpret_cast<<wbr>vtkSliderWidget*>(caller);<br>
double value = static_cast<<wbr>vtkSliderRepresentation2D *>(sliderWidget-><wbr>GetRepresentation())-><wbr>GetValue();<br>
this->SuperToroid->SetN1(<wbr>value);<br>
}<br>
SliderCallbackN1() :SuperToroid(0) {}<br>
vtkParametricSuperToroid *SuperToroid;<br>
};<br>
<br>
class SliderCallbackN2 : public vtkCommand {<br>
public:<br>
static SliderCallbackN2 *New() {<br>
return new SliderCallbackN2;<br>
}<br>
virtual void Execute(vtkObject *caller, unsigned long, void*) {<br>
vtkSliderWidget *sliderWidget =<br>
reinterpret_cast<<wbr>vtkSliderWidget*>(caller);<br>
double value = static_cast<<wbr>vtkSliderRepresentation2D *>(sliderWidget-><wbr>GetRepresentation())-><wbr>GetValue();<br>
this->SuperToroid->SetN2(<wbr>value);<br>
}<br>
SliderCallbackN2() :SuperToroid(0) {}<br>
vtkParametricSuperToroid *SuperToroid;<br>
};<br>
<br>
/**This callback will rotate the surface model about x and y axis depending on the<br>
*current location of the mouse. This will in turn update the cut plane that is ment to<br>
*be normal to the camera and cuts through the middle of the model, showing a red<br>
*cut contour, and green filled contour. */<br>
class InteractionCallback : public vtkCommand {<br>
public:<br>
static InteractionCallback* New() {<br>
return new InteractionCallback;<br>
}<br>
<br>
virtual void Execute(vtkObject*, unsigned long eventID, void* pCallData) VTK_OVERRIDE {<br>
if (eventID == vtkCommand::MouseMoveEvent) {<br>
// Get the current mouse position.<br>
int aiCurrentPosition[2];<br>
m_pInteractor-><wbr>GetEventPosition(<wbr>aiCurrentPosition);<br>
<br>
// Get the view port size.<br>
int iViewPortWidth = m_pInteractor-><wbr>GetRenderWindow()->GetSize()[<wbr>0];<br>
int iViewPortHeight = m_pInteractor-><wbr>GetRenderWindow()->GetSize()[<wbr>1];<br>
<br>
// Compute rotations about x and y axis.<br>
int iMousePositionAboutCenterX = aiCurrentPosition[0] - iViewPortWidth/2.0;<br>
int iMousePositionAboutCenterY = aiCurrentPosition[1] - iViewPortHeight/2.0;<br>
double dRotationAboutX = -iMousePositionAboutCenterY/(<wbr>iViewPortHeight/2.0)*180.0;<br>
double dRotationAboutY = iMousePositionAboutCenterX/(<wbr>iViewPortWidth/2.0)*180.0;<br>
<br>
// Compute transform.<br>
vtkSmartPointer<vtkTransform> sptmSurfacModel = vtkSmartPointer<vtkTransform>:<wbr>:New();<br>
sptmSurfacModel->RotateX(<wbr>dRotationAboutX);<br>
sptmSurfacModel->RotateY(<wbr>dRotationAboutY);<br>
<br>
// Apply the rotation to the surface model actor.<br>
m_pActorSurface-><wbr>SetUserMatrix(sptmSurfacModel-<wbr>>GetMatrix());<br>
<br>
// Apply the change to the cut plan normal vector.<br>
// Translations are not required to be removed from the matrix since there should be none.<br>
double adInitialVector[3];<br>
adInitialVector[0] = 0.0;<br>
adInitialVector[1] = 0.0;<br>
adInitialVector[2] = 1.0;<br>
double adTransformedVector[3];<br>
sptmSurfacModel-><wbr>TransformPoint(<wbr>adInitialVector, adTransformedVector);<br>
m_pCutPlane->SetNormal(<wbr>adTransformedVector[0], adTransformedVector[1], adTransformedVector[2]);<br>
<br>
// Apply the rotation to the contour actor in the opposite direction to make normal to camera.<br>
sptmSurfacModel->Inverse();<br>
m_pActorContour-><wbr>SetUserMatrix(sptmSurfacModel-<wbr>>GetMatrix());<br>
<br>
// Apply the rotation to the filled actor in the opposite direction to make normal to camera.<br>
m_pActorFilled->SetUserMatrix(<wbr>sptmSurfacModel->GetMatrix());<br>
<br>
m_pInteractor->Render();<br>
}<br>
}<br>
<br>
// Member variables<br>
// ----------------<br>
vtkRenderWindowInteractor* m_pInteractor;<br>
vtkActor* m_pActorSurface;<br>
vtkPlane* m_pCutPlane;<br>
vtkActor* m_pActorContour;<br>
vtkActor* m_pActorFilled;<br>
};<br>
<br>
<br>
int main(int, char *[]) {<br>
<br>
vtkSmartPointer<<wbr>vtkParametricSuperToroid> surface =vtkSmartPointer<<wbr>vtkParametricSuperToroid>::<wbr>New();<br>
vtkSmartPointer<<wbr>vtkParametricFunctionSource> source = vtkSmartPointer<<wbr>vtkParametricFunctionSource>::<wbr>New();<br>
source->SetParametricFunction(<wbr>surface);<br>
<br>
// Create a synthetic cone.<br>
/*// Un-commented out so can switch surface model source.<br>
vtkSmartPointer<vtkConeSource> source = vtkSmartPointer<vtkConeSource><wbr>::New();<br>
source->SetCenter(0, 0, 0);<br>
source->SetRadius(1);<br>
source->SetHeight(2);<br>
source->SetResolution(30);<br>
source->Update();<br>
*/<br>
<br>
vtkSmartPointer<vtkRenderer> renderer =vtkSmartPointer<vtkRenderer>:<wbr>:New();<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper> mapper =vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();<br>
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::<wbr>New();<br>
<br>
mapper->SetInputConnection(<wbr>source->GetOutputPort());<br>
<br>
vtkSmartPointer<vtkProperty> backProperty = vtkSmartPointer<vtkProperty>::<wbr>New();<br>
backProperty->SetColor(0.8, 0.8, 0.8);<br>
backProperty->SetOpacity(0.6);<br>
actor->SetMapper(mapper);<br>
actor->SetBackfaceProperty(<wbr>backProperty);<br>
actor->GetProperty()-><wbr>SetDiffuseColor(1, 1, 1);<br>
actor->GetProperty()-><wbr>SetOpacity(0.6);<br>
<br>
vtkSmartPointer<<wbr>vtkRenderWindow> renderWindow =vtkSmartPointer<<wbr>vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(<wbr>renderer);<br>
renderWindow->SetSize(640, 480);<br>
renderer->AddActor(actor);<br>
renderer->SetBackground(.2, .3, .4);<br>
<br>
vtkSmartPointer<<wbr>vtkRenderWindowInteractor> interactor =vtkSmartPointer<<wbr>vtkRenderWindowInteractor>::<wbr>New();<br>
interactor->SetRenderWindow(<wbr>renderWindow);<br>
<br>
// Setup a slider widget for each varying parameter BEGIN<br>
double tubeWidth(.004);<br>
double sliderLength(.004);<br>
double titleHeight(.02);<br>
double labelHeight(.02);<br>
<br>
vtkSmartPointer<<wbr>vtkSliderRepresentation2D> sliderRepN1 = vtkSmartPointer<<wbr>vtkSliderRepresentation2D>::<wbr>New();<br>
<br>
sliderRepN1->SetMinimumValue(<wbr>0.0);<br>
sliderRepN1->SetMaximumValue(<wbr>4.0);<br>
sliderRepN1->SetValue(1.0);<br>
sliderRepN1->SetTitleText("Z squareness");<br>
<br>
sliderRepN1-><wbr>GetPoint1Coordinate()-><wbr>SetCoordinateSystemToNormalize<wbr>dDisplay();<br>
sliderRepN1-><wbr>GetPoint1Coordinate()-><wbr>SetValue(.1, .1);<br>
sliderRepN1-><wbr>GetPoint2Coordinate()-><wbr>SetCoordinateSystemToNormalize<wbr>dDisplay();<br>
sliderRepN1-><wbr>GetPoint2Coordinate()-><wbr>SetValue(.9, .1);<br>
<br>
sliderRepN1->SetTubeWidth(<wbr>tubeWidth);<br>
sliderRepN1->SetSliderLength(<wbr>sliderLength);<br>
sliderRepN1->SetTitleHeight(<wbr>titleHeight);<br>
sliderRepN1->SetLabelHeight(<wbr>labelHeight);<br>
<br>
vtkSmartPointer<<wbr>vtkSliderWidget> sliderWidgetN1 = vtkSmartPointer<<wbr>vtkSliderWidget>::New();<br>
sliderWidgetN1->SetInteractor(<wbr>interactor);<br>
sliderWidgetN1-><wbr>SetRepresentation(sliderRepN1)<wbr>;<br>
sliderWidgetN1-><wbr>SetAnimationModeToAnimate();<br>
sliderWidgetN1->EnabledOn();<br>
<br>
vtkSmartPointer<<wbr>SliderCallbackN1> callbackN1 = vtkSmartPointer<<wbr>SliderCallbackN1>::New();<br>
callbackN1->SuperToroid = surface;<br>
<br>
sliderWidgetN1->AddObserver(<wbr>vtkCommand::InteractionEvent, callbackN1);<br>
<br>
vtkSmartPointer<<wbr>vtkSliderRepresentation2D> sliderRepN2 = vtkSmartPointer<<wbr>vtkSliderRepresentation2D>::<wbr>New();<br>
<br>
sliderRepN2->SetMinimumValue(<wbr>0.0001);<br>
sliderRepN2->SetMaximumValue(<wbr>4.0);<br>
sliderRepN2->SetValue(1.0);<br>
sliderRepN2->SetTitleText("XY squareness");<br>
<br>
sliderRepN2-><wbr>GetPoint1Coordinate()-><wbr>SetCoordinateSystemToNormalize<wbr>dDisplay();<br>
sliderRepN2-><wbr>GetPoint1Coordinate()-><wbr>SetValue(.1, .9);<br>
sliderRepN2-><wbr>GetPoint2Coordinate()-><wbr>SetCoordinateSystemToNormalize<wbr>dDisplay();<br>
sliderRepN2-><wbr>GetPoint2Coordinate()-><wbr>SetValue(.9, .9);<br>
<br>
sliderRepN2->SetTubeWidth(<wbr>tubeWidth);<br>
sliderRepN2->SetSliderLength(<wbr>sliderLength);<br>
sliderRepN2->SetTitleHeight(<wbr>titleHeight);<br>
sliderRepN2->SetLabelHeight(<wbr>labelHeight);<br>
<br>
vtkSmartPointer<<wbr>vtkSliderWidget> sliderWidgetN2 = vtkSmartPointer<<wbr>vtkSliderWidget>::New();<br>
sliderWidgetN2->SetInteractor(<wbr>interactor);<br>
sliderWidgetN2-><wbr>SetRepresentation(sliderRepN2)<wbr>;<br>
sliderWidgetN2-><wbr>SetAnimationModeToAnimate();<br>
sliderWidgetN2->EnabledOn();<br>
<br>
vtkSmartPointer<<wbr>SliderCallbackN2> callbackN2 = vtkSmartPointer<<wbr>SliderCallbackN2>::New();<br>
callbackN2->SuperToroid = surface;<br>
<br>
sliderWidgetN2->AddObserver(<wbr>vtkCommand::InteractionEvent, callbackN2);<br>
<br>
vtkSmartPointer<<wbr>vtkSliderRepresentation2D> sliderRepMinimumV = vtkSmartPointer<<wbr>vtkSliderRepresentation2D>::<wbr>New();<br>
<br>
sliderRepN1->SetMinimumValue(.<wbr>0001);<br>
sliderRepMinimumV-><wbr>SetMaximumValue(.9999*vtkMath:<wbr>:Pi());<br>
sliderRepMinimumV->SetValue(.<wbr>0001);<br>
sliderRepMinimumV-><wbr>SetTitleText("V min");<br>
<br>
sliderRepMinimumV-><wbr>GetPoint1Coordinate()-><wbr>SetCoordinateSystemToNormalize<wbr>dDisplay();<br>
sliderRepMinimumV-><wbr>GetPoint1Coordinate()-><wbr>SetValue(.1, .1);<br>
sliderRepMinimumV-><wbr>GetPoint2Coordinate()-><wbr>SetCoordinateSystemToNormalize<wbr>dDisplay();<br>
sliderRepMinimumV-><wbr>GetPoint2Coordinate()-><wbr>SetValue(.1, .9);<br>
<br>
sliderRepMinimumV-><wbr>SetTubeWidth(tubeWidth);<br>
sliderRepMinimumV-><wbr>SetSliderLength(sliderLength);<br>
sliderRepMinimumV-><wbr>SetTitleHeight(titleHeight);<br>
sliderRepMinimumV-><wbr>SetLabelHeight(labelHeight);<br>
<br>
surface->SetN1(1.0);<br>
surface->SetN2(1.0);<br>
// Setup a slider widget for each varying parameter END<br>
<br>
// Set up the cut plane.<br>
vtkSmartPointer<vtkPlane> planeCut = vtkSmartPointer<vtkPlane>::<wbr>New();<br>
planeCut->SetOrigin(0.0, 0.0, 0.0);<br>
planeCut->SetNormal(0.0, 0.0, 1.0);<br>
<br>
// Set up the cutter which will produce the contour polygons.<br>
vtkSmartPointer<vtkCutter> polygonsContour = vtkSmartPointer<vtkCutter>::<wbr>New();<br>
//vtkSmartPointer<<wbr>vtkPlaneCutter> polygonsContour = vtkSmartPointer<<wbr>vtkPlaneCutter>::New(); // testjal<br>
polygonsContour-><wbr>SetInputConnection(source-><wbr>GetOutputPort());<br>
//polygonsContour->SetPlane(<wbr>planeCut); // SetPlane only works with a vtkPlaneCutter. // testjal<br>
polygonsContour-><wbr>SetCutFunction(planeCut);<br>
<br>
// Clean the polygons from the cutter. Note, this is an experiment to see if this helps the fills. It does not<br>
// seem to help.<br>
vtkSmartPointer<<wbr>vtkCleanPolyData> polygonsContourClean = vtkSmartPointer<<wbr>vtkCleanPolyData>::New(); // testjal<br>
polygonsContourClean-><wbr>SetInputConnection(<wbr>polygonsContour-><wbr>GetOutputPort()); // testjal<br>
<br>
// Set up the filled polygons of the contour.<br>
vtkSmartPointer<<wbr>vtkContourTriangulator> polygonsFilled = vtkSmartPointer<<wbr>vtkContourTriangulator>::New()<wbr>;<br>
polygonsFilled-><wbr>SetInputConnection(<wbr>polygonsContourClean-><wbr>GetOutputPort());<br>
polygonsFilled-><wbr>TriangulationErrorDisplayOn(); // testjal<br>
<br>
// Set up the mapper of the contour.<br>
vtkSmartPointer<<wbr>vtkDataSetMapper> mapperContour = vtkSmartPointer<<wbr>vtkDataSetMapper>::New();<br>
mapperContour-><wbr>SetInputConnection(<wbr>polygonsContourClean-><wbr>GetOutputPort());<br>
mapperContour-><wbr>ScalarVisibilityOff();<br>
<br>
// Set up the mapper of the filled polygons of the contour<br>
vtkSmartPointer<<wbr>vtkDataSetMapper> mapperFilled = vtkSmartPointer<<wbr>vtkDataSetMapper>::New();<br>
mapperFilled-><wbr>SetInputConnection(<wbr>polygonsFilled->GetOutputPort(<wbr>));<br>
mapperFilled-><wbr>ScalarVisibilityOff();<br>
<br>
// Set up the actor of the contour.<br>
vtkSmartPointer<vtkActor> actorContour = vtkSmartPointer<vtkActor>::<wbr>New();<br>
actorContour->SetMapper(<wbr>mapperContour);<br>
actorContour->GetProperty()-><wbr>SetColor(1,0,0);<br>
actorContour->GetProperty()-><wbr>SetLineWidth(5);<br>
<br>
// Set up the actor of the filled polygons of the contour.<br>
vtkSmartPointer<vtkActor> actorFilled = vtkSmartPointer<vtkActor>::<wbr>New();<br>
actorFilled->SetMapper(<wbr>mapperFilled);<br>
actorFilled->GetProperty()-><wbr>SetColor(0, 1, 0);<br>
<br>
// Add the contour actor.<br>
renderer->AddActor(<wbr>actorContour);<br>
<br>
// Add the filld polygons of the contour.<br>
renderer->AddActor(<wbr>actorFilled);<br>
<br>
// Set up the interaction.<br>
vtkSmartPointer<<wbr>InteractionCallback> callback = vtkSmartPointer<<wbr>InteractionCallback>::New();<br>
callback->m_pInteractor = interactor.Get();<br>
callback->m_pActorSurface = actor.Get();<br>
callback->m_pCutPlane = planeCut.Get();<br>
callback->m_pActorContour = actorContour.Get();<br>
callback->m_pActorFilled = actorFilled.Get();<br>
vtkSmartPointer<<wbr>vtkInteractorStyle> style = vtkSmartPointer<<wbr>vtkInteractorStyle>::New();<br>
interactor-><wbr>SetInteractorStyle(style);<br>
style->AddObserver(vtkCommand:<wbr>:MouseMoveEvent, callback);<br>
<br>
renderer->ResetCamera(-1, 1, -1, 1, -1, 1);<br>
renderer->GetActiveCamera()-><wbr>ParallelProjectionOn();<br>
renderWindow->Render();<br>
<br>
interactor->Initialize();<br>
<br>
interactor->Start();<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
-----Original Message-----<br>
From: vtkusers [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.<wbr>org</a>] On Behalf Of <a href="mailto:vtkusers-request@vtk.org">vtkusers-request@vtk.org</a><br>
Sent: Friday, March 02, 2018 3:19 PM<br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Subject: vtkusers Digest, Vol 167, Issue 6<br>
<br>
Send vtkusers mailing list submissions to<br>
<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__vtk.org_mailman_listinfo_vtkusers&d=DwICAg&c=xPsIBl5KrHsS6I-OqwKVfQ&r=D9BdhfXHHQX-uhgMiAohLoGTItPHXF-7rtsYkItEKmE&m=LEPlWwob3RaATj2F7NLtpCgz9jCbYxrZVKqUBxw04QA&s=Ej7w16ZJQy02Uvg3d2LzSZ7xIDDkBIUqNYKBToY2xxE&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__vtk.<wbr>org_mailman_listinfo_vtkusers&<wbr>d=DwICAg&c=xPsIBl5KrHsS6I-<wbr>OqwKVfQ&r=D9BdhfXHHQX-<wbr>uhgMiAohLoGTItPHXF-<wbr>7rtsYkItEKmE&m=<wbr>LEPlWwob3RaATj2F7NLtpCgz9jCbYx<wbr>rZVKqUBxw04QA&s=<wbr>Ej7w16ZJQy02Uvg3d2LzSZ7xIDDkBI<wbr>UqNYKBToY2xxE&e=</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:vtkusers-request@vtk.org">vtkusers-request@vtk.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:vtkusers-owner@vtk.org">vtkusers-owner@vtk.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific than "Re: Contents of vtkusers digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Problem with vtkContourTriangulator and vtkPlaneCutter<br>
      (Jeffery Lewis)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Fri, 2 Mar 2018 22:57:44 +0000<br>
From: Jeffery Lewis <<a href="mailto:jlewis@accuray.com">jlewis@accuray.com</a>><br>
To: "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Subject: [vtkusers] Problem with vtkContourTriangulator and<br>
vtkPlaneCutter<br>
Message-ID:<br>
<<a href="mailto:DM5PR0501MB3749070F9E8CBAEFFE5D3241C5C50@DM5PR0501MB3749.namprd05.prod.outlook.com">DM5PR0501MB3749070F9E8CBAEFFE<wbr>5D3241C5C50@DM5PR0501MB3749.<wbr>namprd05.prod.outlook.com</a>><br>
<br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
I have a prototype that generates a super toroid surface model. A cut plane is defined to be orthogonal to the camera line of sight, and cuts through the middle of the surface model. The cut contour (generated by vtkCutter), and filled cut contour (generated by vtkContourTriangulator) is rendered with the surface model. The surface model is shown transparent as it is only a reference. The rendering of interest is the cut contour (shown as red contour) and filled cut contour (shown as green). Moving the mouse rotates the surface model. The cut plane stays orthogonal to the camera while the surface model rotates. By rotating the surface model, you can see the cut contour and filled cut contour get updated interactively as it slices through the middle of the surface model.<br>
<br>
Unfortunately, the filled cut contour does not look right and I can't seem to figure it out. If I change the surface model to something simpler like a cone, then everything looks fine.<br>
<br>
Also of note is that if I switch out the vtkCutter with a vtkPlaneCutter, the program crashes. I would like to use the vtkPlaneCutter since from its documentation seems to indicate that it will get better performance. The vtkPlaneCutter crashes using either the super toroid or cone.<br>
<br>
Attached is the source code. The stuff between "// Setup a slider widget for each varying parameter BEGIN" and "// Setup a slider widget for each varying parameter END" can be ignored as this only involves setting up sliders to manipulate the super toroid, which comes from the ParametricSuperToroidDemo example. The setup of the pipleline for the cut contour and filled cut contour is near the bottom.<br>
<br>
Also attached is a sample screen shot of the incorrect filled cut contour.<br>
<br>
<br><br>
<br>
Jeffery Lewis<br>
Staff Software Engineer, Treatment Planning Systems<br>
<br>
1310 Chesapeake Terrace<br>
Sunnyvale, CA 94089<br>
USA<br>
Tel: <a href="tel:1.408.789.4367" value="+14087894367">1.408.789.4367</a><br>
<a href="mailto:jlewis@accuray.com">jlewis@accuray.com</a><br>
<br>
<br></blockquote></div><div><br></div>-- <br><div class="gmail_signature">___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________</div>
</div></div>