本文整理汇总了C++中Viewer3D::setLineColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer3D::setLineColor方法的具体用法?C++ Viewer3D::setLineColor怎么用?C++ Viewer3D::setLineColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer3D
的用法示例。
在下文中一共展示了Viewer3D::setLineColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char** argv )
{
//! [MeshUseInitDisplay]
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
//! [MeshUseInitDisplay]
//! [MeshUseMeshCreation]
// A mesh is constructed and faces are added from the vertex set.
//! [MeshUseMeshConstructor]
Mesh<Point> aMesh(true);
//! [MeshUseMeshConstructor]
//! [MeshUseMeshAddingPoints]
aMesh.addVertex(Point(0,0,0));
aMesh.addVertex(Point(1,0,0));
aMesh.addVertex(Point(1,1,0));
//! [MeshUseMeshAddingPoints]
aMesh.addVertex(Point(0,0,1));
aMesh.addVertex(Point(1,0,1));
aMesh.addVertex(Point(1,1,1));
aMesh.addVertex(Point(0,1,1));
aMesh.addVertex(Point(0,1,0));
aMesh.addVertex(Point(0,2,0));
aMesh.addVertex(Point(0,3,1));
aMesh.addVertex(Point(0,2,2));
aMesh.addVertex(Point(0,1,2));
aMesh.addVertex(Point(0,0,1));
//! [MeshUseMeshAddingBasicFaces]
aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
aMesh.addQuadFace(6,5,4,3, Color::Blue);
//! [MeshUseMeshAddingBasicFaces]
//! [MeshUseMeshAddingPolygonalFaces]
vector<unsigned int> listIndex;
listIndex.push_back(7);
listIndex.push_back(8);
listIndex.push_back(9);
listIndex.push_back(10);
listIndex.push_back(11);
listIndex.push_back(12);
aMesh.addFace(listIndex, Color(150,150,0,54));
//! [MeshUseMeshAddingPolygonalFaces]
//! [MeshUseMeshCreation]
//! [MeshUseDisplay]
viewer.setLineColor(Color(150,0,0,254));
viewer << aMesh;
viewer << Viewer3D<>::updateDisplay;
//! [MeshUseDisplay]
bool res = application.exec();
FATAL_ERROR(res);
return true;
}
示例2: displayAxes
void displayAxes( Viewer3D<space, kspace> & viewer,
const Point & lowerBound, const Point & upperBound,
const std::string & mode )
{
RealPoint p0( (double)lowerBound[ 0 ]-0.5,
(double)lowerBound[ 1 ]-0.5,
(double)lowerBound[ 2 ]-0.5 );
RealPoint p1( (double)upperBound[ 0 ]-0.5,
(double)upperBound[ 1 ]-0.5,
(double)upperBound[ 2 ]-0.5 );
if ( ( mode == "WIRED" ) || ( mode == "COLORED" ) )
{
viewer.setLineColor(AXIS_COLOR);
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]), AXIS_LINESIZE );
}
if ( mode == "COLORED" )
{
viewer.setFillColor(XY_COLOR);
viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]) );
viewer.setFillColor(XZ_COLOR);
viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]));
viewer.setFillColor(YZ_COLOR);
viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]));
}
}
示例3: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Testing class MeshFromPointsDisplay" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
//! [MeshFromPointsUseInitDisplay]
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
//! [MeshFromPointsUseInitDisplay]
//! [MeshFromPointsUseMeshCreation]
MeshFromPoints<Point> aMesh(true);
aMesh.addVertex(Point(0,0,0));
aMesh.addVertex(Point(1,0,0));
aMesh.addVertex(Point(1,1,0));
aMesh.addVertex(Point(0,0,1));
aMesh.addVertex(Point(1,0,1));
aMesh.addVertex(Point(1,1,1));
aMesh.addVertex(Point(0,1,1));
aMesh.addVertex(Point(0,1,0));
aMesh.addVertex(Point(0,2,0));
aMesh.addVertex(Point(0,3,1));
aMesh.addVertex(Point(0,2,2));
aMesh.addVertex(Point(0,1,2));
aMesh.addVertex(Point(0,0,1));
aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
aMesh.addQuadFace(6,5,4,3, Color::Blue);
vector<unsigned int> listIndex;
listIndex.push_back(7);
listIndex.push_back(8);
listIndex.push_back(9);
listIndex.push_back(10);
listIndex.push_back(11);
listIndex.push_back(12);
aMesh.addFace(listIndex, Color(150,150,0,54));
//! [MeshFromPointsUseMeshCreation]
//! [MeshFromPointsUseDisplay]
viewer.setLineColor(Color(150,0,0,254));
viewer << aMesh;
viewer << Viewer3D::updateDisplay;
bool res = application.exec();
//! [MeshFromPointsUseDisplay]
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}
示例4: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
//! [ImportOFFfile]
std::string inputFilename = examplesPath + "samples/tref.off";
// Since the input points are not necessary integers we use the PointD3D from Display3D.
Mesh<Viewer3D<>::RealPoint> anImportedMesh;
anImportedMesh << inputFilename;
//! [ImportOFFfile]
trace.info()<< "importating done..."<< endl;
//! [displayOFFfile]
viewer.setLineColor(DGtal::Color(150,0,0,254));
viewer << anImportedMesh;
viewer << Viewer3D<>::updateDisplay;
//! [displayOFFfile]
return application.exec();
}
示例5: displayDSS2d
void displayDSS2d( Viewer3D<space, kspace> & viewer,
const KSpace & ks, const StandardDSS6Computer & dss3d,
const DGtal::Color & color2d )
{
typedef typename StandardDSS6Computer::ConstIterator ConstIterator3d;
typedef typename StandardDSS6Computer::ArithmeticalDSSComputer2d ArithmeticalDSSComputer2d;
typedef typename ArithmeticalDSSComputer2d::ConstIterator ConstIterator2d;
typedef typename ArithmeticalDSSComputer2d::Point Point2d;
typedef typename KSpace::Cell Cell;
typedef typename KSpace::Point Point3d;
typedef DGtal::PointVector<2,double> PointD2d;
typedef typename Display3D<>::BallD3D PointD3D;
Point3d b = ks.lowerBound();
for ( DGtal::Dimension i = 0; i < 3; ++i )
{
const typename ArithmeticalDSSComputer2d::Primitive & dss2d
= dss3d.arithmeticalDSS2d( i ).primitive();
// draw 2D bounding boxes for each arithmetical dss 2D.
std::vector<PointD2d> pts2d;
pts2d.push_back( dss2d.project(dss2d.back(), dss2d.Uf()) );
pts2d.push_back( dss2d.project(dss2d.back(), dss2d.Lf()) );
pts2d.push_back( dss2d.project(dss2d.front(), dss2d.Lf()) );
pts2d.push_back( dss2d.project(dss2d.front(), dss2d.Uf()) );
std::vector<PointD3D> bb;
PointD3D p3;
for ( unsigned int j = 0; j < pts2d.size(); ++j )
{
switch (i) {
case 0: p3.center[0] = (double) b[ i ]-0.5; p3.center[1] = pts2d[ j ][ 0 ]; p3.center[2] = pts2d[ j ][ 1 ]; break;
case 1: p3.center[0] = pts2d[ j ][ 0 ]; p3.center[1] = (double) b[ i ]-0.5; p3.center[2] = pts2d[ j ][ 1 ]; break;
case 2: p3.center[0] = pts2d[ j ][ 0 ]; p3.center[1] = pts2d[ j ][ 1 ]; p3.center[2] = (double) b[ i ]-0.5; break;
}
bb.push_back( p3 );
}
for ( unsigned int j = 0; j < pts2d.size(); ++j ){
viewer.setLineColor(color2d);
viewer.addLine( DGtal::Z3i::RealPoint(bb[ j ].center[0], bb[ j ].center[1], bb[ j ].center[2]),
DGtal::Z3i::RealPoint(bb[ (j+1)%4 ].center[0], bb[ (j+1)%4 ].center[1], bb[ (j+1)%4 ].center[2]),
MS3D_LINESIZE );
}
} // for ( DGtal::Dimension i = 0; i < 3; ++i )
}
示例6: displayDSS3dTangent
void displayDSS3dTangent( Viewer3D<space, kspace> & viewer,
const KSpace & ks, const StandardDSS6Computer & dss3d,
const DGtal::Color & color3d )
{
typedef typename StandardDSS6Computer::Point3d Point;
typedef typename StandardDSS6Computer::PointD3d PointD3d;
typedef typename Display3D<>::BallD3D PointD3D;
Point directionZ3;
PointD3d P1, P2, direction, intercept, thickness;
dss3d.getParameters( directionZ3, intercept, thickness );
assign( direction, directionZ3 );
direction /= direction.norm();
assign( P1, *dss3d.begin() );
assign( P2, *(dss3d.end()-1) );
double t1 = (P1 - intercept).dot( direction );
double t2 = (P2 - intercept).dot( direction );
PointD3d Q1 = intercept + t1 * direction;
PointD3d Q2 = intercept + t2 * direction;
viewer.setLineColor(color3d);
viewer.addLine( DGtal::Z3i::RealPoint(Q1[ 0 ]-0.5, Q1[ 1 ]-0.5, Q1[ 2 ]-0.5),
DGtal::Z3i::RealPoint(Q2[ 0 ]-0.5, Q2[ 1 ]-0.5, Q2[ 2 ]-0.5),
MS3D_LINESIZE );
}
示例7: main
int main( int argc, char** argv )
{
if ( argc < 5 )
{
usage( argc, argv );
return 1;
}
std::string inputFilename = argv[ 1 ];
unsigned int minThreshold = atoi( argv[ 2 ] );
unsigned int maxThreshold = atoi( argv[ 3 ] );
bool intAdjacency = atoi( argv[ 4 ] ) == 0;
typedef ImageSelector < Domain, int>::Type Image;
//! [viewMarchingCubes-readVol]
trace.beginBlock( "Reading vol file into an image." );
Image image = VolReader<Image>::importVol(inputFilename);
DigitalSet set3d (image.domain());
SetFromImage<DigitalSet>::append<Image>(set3d, image,
minThreshold, maxThreshold);
trace.endBlock();
//! [viewMarchingCubes-readVol]
//! [viewMarchingCubes-KSpace]
trace.beginBlock( "Construct the Khalimsky space from the image domain." );
KSpace ks;
bool space_ok = ks.init( image.domain().lowerBound(),
image.domain().upperBound(), true );
if (!space_ok)
{
trace.error() << "Error in the Khamisky space construction."<<std::endl;
return 2;
}
trace.endBlock();
//! [viewMarchingCubes-KSpace]
//! [viewMarchingCubes-SurfelAdjacency]
typedef SurfelAdjacency<KSpace::dimension> MySurfelAdjacency;
MySurfelAdjacency surfAdj( intAdjacency ); // interior in all directions.
//! [viewMarchingCubes-SurfelAdjacency]
//! [viewMarchingCubes-ExtractingSurface]
trace.beginBlock( "Extracting boundary by scanning the space. " );
typedef KSpace::SurfelSet SurfelSet;
typedef SetOfSurfels< KSpace, SurfelSet > MySetOfSurfels;
typedef DigitalSurface< MySetOfSurfels > MyDigitalSurface;
MySetOfSurfels theSetOfSurfels( ks, surfAdj );
Surfaces<KSpace>::sMakeBoundary( theSetOfSurfels.surfelSet(),
ks, set3d,
image.domain().lowerBound(),
image.domain().upperBound() );
MyDigitalSurface digSurf( theSetOfSurfels );
trace.info() << "Digital surface has " << digSurf.size() << " surfels."
<< std::endl;
trace.endBlock();
//! [viewMarchingCubes-ExtractingSurface]
//! [viewMarchingCubes-makingMesh]
trace.beginBlock( "Making triangulated surface. " );
typedef CanonicEmbedder< Space > TrivialEmbedder;
typedef ImageLinearCellEmbedder< KSpace, Image, TrivialEmbedder > CellEmbedder;
typedef CellEmbedder::Value RealPoint;
typedef TriangulatedSurface< RealPoint > TriMesh;
typedef Mesh< RealPoint > ViewMesh;
typedef std::map< MyDigitalSurface::Vertex, TriMesh::Index > VertexMap;
TriMesh trimesh;
ViewMesh viewmesh;
TrivialEmbedder trivialEmbedder;
CellEmbedder cellEmbedder;
// The +0.5 is to avoid isosurface going exactly through a voxel
// center, especially for binary volumes.
cellEmbedder.init( ks, image, trivialEmbedder,
( (double) minThreshold ) + 0.5 );
VertexMap vmap; // stores the map Vertex -> Index
MeshHelpers::digitalSurface2DualTriangulatedSurface
( digSurf, cellEmbedder, trimesh, vmap );
trace.info() << "Triangulated surface is " << trimesh << std::endl;
MeshHelpers::triangulatedSurface2Mesh( trimesh, viewmesh );
trace.info() << "Mesh has " << viewmesh.nbVertex()
<< " vertices and " << viewmesh.nbFaces() << " faces." << std::endl;
trace.endBlock();
//! [viewMarchingCubes-makingMesh]
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
viewer.setLineColor(Color(150,0,0,254));
viewer << viewmesh;
viewer << Viewer3D<>::updateDisplay;
application.exec();
}
示例8: main
//.........这里部分代码省略.........
}
if(vm.count("customColorSDP")) {
std::vector<unsigned int > vectCol = vm["customColorSDP"].as<std::vector<unsigned int> >();
if(vectCol.size()!=4) {
trace.error() << "colors specification should contain R,G,B and Alpha values"<< std::endl;
}
sdpColorR = vectCol[0];
sdpColorG = vectCol[1];
sdpColorB = vectCol[2];
sdpColorA = vectCol[3];
}
QApplication application(argc,argv);
Viewer3D<> viewer;
std::stringstream title;
title << "Simple Mesh Viewer: " << inputFilenameVect[0];
viewer.setWindowTitle(title.str().c_str());
viewer.show();
viewer.myGLLineMinWidth = lineWidth;
viewer.setGLScale(sx, sy, sz);
bool invertNormal= vm.count("invertNormal");
double ballRadius = vm["SDPradius"].as<double>();
trace.info() << "Importing mesh... ";
std::vector<Mesh<DGtal::Z3i::RealPoint> > vectMesh;
for(unsigned int i = 0; i< inputFilenameVect.size(); i++) {
Mesh<DGtal::Z3i::RealPoint> aMesh(!vm.count("customColorMesh"));
aMesh << inputFilenameVect[i];
vectMesh.push_back(aMesh);
}
bool import = vectMesh.size()==inputFilenameVect.size();
if(!import) {
trace.info() << "File import failed. " << std::endl;
return 0;
}
trace.info() << "[done]. "<< std::endl;
if(vm.count("displaySDP")) {
std::string filenameSDP = vm["displaySDP"].as<std::string>();
vector<Z3i::RealPoint> vectPoints;
vectPoints = PointListReader<Z3i::RealPoint>::getPointsFromFile(filenameSDP);
viewer << CustomColors3D(Color(sdpColorR, sdpColorG, sdpColorB, sdpColorA),
Color(sdpColorR, sdpColorG, sdpColorB, sdpColorA));
for(unsigned int i=0; i< vectPoints.size(); i++) {
viewer.addBall(vectPoints.at(i), ballRadius);
}
}
if(invertNormal) {
for(unsigned int i=0; i<vectMesh.size(); i++) {
vectMesh[i].invertVertexFaceOrder();
}
}
viewer << CustomColors3D(Color(meshColorRLine, meshColorGLine, meshColorBLine, meshColorALine),
Color(meshColorR, meshColorG, meshColorB, meshColorA));
for(unsigned int i=0; i<vectMesh.size(); i++) {
viewer << vectMesh[i];
}
if(vm.count("drawVertex")) {
for(unsigned int i=0; i<vectMesh.size(); i++) {
for( Mesh<DGtal::Z3i::RealPoint>::VertexStorage::const_iterator it = vectMesh[i].vertexBegin();
it!=vectMesh[i].vertexEnd(); ++it) {
DGtal::Z3i::Point pt;
pt[0]=(*it)[0];
pt[1]=(*it)[1];
pt[2]=(*it)[2];
viewer << pt;
}
}
}
if (displayVectorField) {
std::vector<unsigned int > vectFieldIndices1 = {vectFieldIndices[0],vectFieldIndices[1], vectFieldIndices[2]};
std::vector<unsigned int > vectFieldIndices2 = {vectFieldIndices[3],vectFieldIndices[4], vectFieldIndices[5]};
std::vector<DGtal::Z3i::RealPoint> vectPt1 = PointListReader<DGtal::Z3i::RealPoint>::getPointsFromFile(vm["displayVectorField"].as<std::string>(), vectFieldIndices1);
std::vector<DGtal::Z3i::RealPoint> vectPt2 = PointListReader<DGtal::Z3i::RealPoint>::getPointsFromFile(vm["displayVectorField"].as<std::string>(), vectFieldIndices2);
viewer.createNewLineList();
for (unsigned int i = 0; i < vectPt1.size(); i++) {
viewer.setLineColor(vFieldLineColor);
viewer.addLine(vectPt1[i], vectPt2[i]);
}
}
viewer << Viewer3D<>::updateDisplay;
return application.exec();
}