Skip to content

Commit

Permalink
update vtk geometry rendering + new PolyDataCollection for new exports
Browse files Browse the repository at this point in the history
  • Loading branch information
thliebig committed Nov 6, 2010
1 parent 2d483f0 commit 7d29b99
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 42 deletions.
2 changes: 1 addition & 1 deletion QCSXCAD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ void QGeometryPlot::paintEvent(QPaintEvent * /* event */)
double xyz[3];
int nP = (direct+1)%3;
int nPP = (direct+2)%3;
for (int n=0;n<nrPts;++n)
for (unsigned int n=0;n<nrPts;++n)
{
curve->GetPoint(n,xyz);
points[n].setX((xyz[nP]-offsetX)/factor);
Expand Down
36 changes: 10 additions & 26 deletions QVTKStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "vtkAxesActor.h"
#include "vtkActor.h"
#include "ContinuousStructure.h"
#include "ParameterCoord.h"
#include "VTKPrimitives.h"
#include "QVTKStructure.h"
#include "vtkCubeSource.h"
Expand Down Expand Up @@ -322,29 +323,18 @@ void QVTKStructure::RenderGeometry()
{
CSPrimitives* prim = prop->GetPrimitive(n);
if (prim==NULL) return;
CoordinateSystem primCS = prim->GetCoordinateSystem();
if (primCS==UNDEFINED_CS)
primCS=clCS->GetCoordInputType();
switch (prim->GetType())
{
case CSPrimitives::BOX:
{
CSPrimBox* box = prim->ToBox();
double coords[6];
double val0,val1;
for (unsigned int a=0;a<3;++a)
{
val0=box->GetCoord(2*a);
val1=box->GetCoord(2*a+1);
if (val0<=val1)
{
coords[2*a]=val0;
coords[2*a+1]=val1;
}
else
{
coords[2*a]=val1;
coords[2*a+1]=val0;
}
}
vtkPrims->AddCube(coords,rgb,(double)col.a/255.0);
if (primCS==CARTESIAN)
vtkPrims->AddCube(box->GetStartCoord()->GetCartesianCoords(),box->GetStopCoord()->GetCartesianCoords(),rgb,(double)col.a/255.0);
else if (primCS==CYLINDRICAL)
vtkPrims->AddCylindricalCube(box->GetStartCoord()->GetCylindricalCoords(),box->GetStopCoord()->GetCylindricalCoords(),rgb,(double)col.a/255.0);
break;
}
case CSPrimitives::MULTIBOX:
Expand All @@ -368,19 +358,13 @@ void QVTKStructure::RenderGeometry()
case CSPrimitives::SPHERE:
{
CSPrimSphere* sphere = prim->ToSphere();
double coords[3];
for (int a=0;a<3;++a) coords[a]=sphere->GetCoord(a);
vtkPrims->AddSphere(coords,sphere->GetRadius(),rgb,(double)col.a/255.0,iResolution);
vtkPrims->AddSphere(sphere->GetCenter()->GetCartesianCoords(),sphere->GetRadius(),rgb,(double)col.a/255.0,iResolution);
break;
}
case CSPrimitives::CYLINDER:
{
CSPrimCylinder* cylinder = prim->ToCylinder();
double start[3];
double direction[3];
for (int a=0;a<3;++a) start[a]=cylinder->GetCoord(2*a);
for (int a=0;a<3;++a) direction[a]=cylinder->GetCoord(2*a+1)-start[a];
vtkPrims->AddCylinder(start,direction,cylinder->GetRadius(),rgb,(double)col.a/255.0,iResolution);
vtkPrims->AddCylinder2(cylinder->GetAxisStartCoord()->GetCartesianCoords(),cylinder->GetAxisStopCoord()->GetCartesianCoords(),cylinder->GetRadius(),rgb,(double)col.a/255.0,iResolution);
break;
}
case CSPrimitives::POLYGON:
Expand Down
Loading

0 comments on commit 7d29b99

Please sign in to comment.