Fade2D Documentation pages v2.16.8
Delaunay Features
GEOM_FADE2D::VtkWriter Class Reference

A class for writing data to the VTK file format for visualization purposes. More...

#include <VtkWriter.h>

Public Member Functions

 VtkWriter (const char *name)
 Constructor for the VtkWriter class. More...
 
 ~VtkWriter ()
 Destructor for the VtkWriter class.
 
void addPoint (const Point2 &p, VtkColor color)
 Add a single point. More...
 
void addPoints (const std::vector< Point2 * > &vPoints, VtkColor color)
 Add multiple points. More...
 
void addPoints (const std::vector< Point2 > &vPoints, VtkColor color)
 Add multiple points. More...
 
void addSegment (const Point2 &source, const Point2 &target, VtkColor color, bool bWithEndPoints=false)
 Add a segment. More...
 
void addSegment (const Segment2 &segment, VtkColor color, bool bWithEndPoints=false)
 Add a segment. More...
 
void addSegments (const std::vector< Edge2 > &vEdges, VtkColor color, bool bWithEndPoints=false)
 Add multiple Edge2 objects. More...
 
void addSegments (const std::vector< Point2 > &vSegmentEndPoints, VtkColor color, bool bWithEndPoints=false)
 Add multiple segments. More...
 
void addSegments (const std::vector< Segment2 > &vSegments, VtkColor color, bool bWithEndPoints=false)
 Add multiple segments. More...
 
void addTriangle (const Point2 &p0, const Point2 &p1, const Point2 &p2, VtkColor color)
 Add a triangle defined by three points. More...
 
void addTriangle (const Triangle2 &t, VtkColor color)
 Add a single triangle. More...
 
void addTriangles (const std::vector< Point2 > &vTriangleCorners, VtkColor color)
 Add multiple triangles. More...
 
void addTriangles (const std::vector< Triangle2 * > &vT, VtkColor color)
 Add multiple triangles. More...
 
VtkColor getNextColor ()
 Get the next color in the predefined sequence of colors. More...
 
void writeFile ()
 Finalize the visualization. More...
 

Detailed Description

Example visualization using the VTK file format and the Paraview Viewer

This class visualizes 3D scenes by outputting various geometric objects (such as points, segments, and triangles) to a VTK file. VTK files are compatible with many viewers, and if you're new to this format, you may want to try Paraview for visualization.

You can use this class to create custom 2D and 3D scenes, or use pre-made VTK visualizations available in classes like Fade_2D and Zone2.

See also
Fade_2D::showVtk()
Zone2::showVtk()

Constructor & Destructor Documentation

◆ VtkWriter()

GEOM_FADE2D::VtkWriter::VtkWriter ( const char *  name)
explicit
Parameters
nameThe name of the output VTK file.

Member Function Documentation

◆ addPoint()

void GEOM_FADE2D::VtkWriter::addPoint ( const Point2 p,
VtkColor  color 
)

Adds a single point to the VTK file with a specified color.

Parameters
pThe point to add.
colorThe color of the point.

◆ addPoints() [1/2]

void GEOM_FADE2D::VtkWriter::addPoints ( const std::vector< Point2 * > &  vPoints,
VtkColor  color 
)

Adds multiple points with a specified color to the VTK file.

Parameters
vPointsA vector of points to add.
colorThe color of the points.

◆ addPoints() [2/2]

void GEOM_FADE2D::VtkWriter::addPoints ( const std::vector< Point2 > &  vPoints,
VtkColor  color 
)

Adds multiple points with a specified color to the VTK file.

Parameters
vPointsA vector of points to add.
colorThe color of the points.

◆ addSegment() [1/2]

void GEOM_FADE2D::VtkWriter::addSegment ( const Point2 source,
const Point2 target,
VtkColor  color,
bool  bWithEndPoints = false 
)

Adds a segment defined by source and target points with a specified color to the VTK file.

Parameters
sourceThe source point of the segment.
targetThe target point of the segment.
colorThe color of the segment.
bWithEndPointsWhether to include the end points in the visualization.

◆ addSegment() [2/2]

void GEOM_FADE2D::VtkWriter::addSegment ( const Segment2 segment,
VtkColor  color,
bool  bWithEndPoints = false 
)

Adds a segment with a specified color to the VTK file.

Parameters
segmentThe segment to add.
colorThe color of the segment.
bWithEndPointsWhether to include the end points in the visualization.

◆ addSegments() [1/3]

void GEOM_FADE2D::VtkWriter::addSegments ( const std::vector< Edge2 > &  vEdges,
VtkColor  color,
bool  bWithEndPoints = false 
)

Adds multiple Edge2 objects with a specified color to the VTK file.

Parameters
vEdgesA vector of Edge2 objects to add.
colorThe color of the edges.
bWithEndPointsWhether to include the end points in the visualization.

◆ addSegments() [2/3]

void GEOM_FADE2D::VtkWriter::addSegments ( const std::vector< Point2 > &  vSegmentEndPoints,
VtkColor  color,
bool  bWithEndPoints = false 
)

Adds multiple segments defined by pairs of endpoints with a specified color to the VTK file.

Parameters
vSegmentEndPointsA vector of point pairs defining the endpoints of the segments.
colorThe color of the segments.
bWithEndPointsWhether to include the end points in the visualization.

◆ addSegments() [3/3]

void GEOM_FADE2D::VtkWriter::addSegments ( const std::vector< Segment2 > &  vSegments,
VtkColor  color,
bool  bWithEndPoints = false 
)

Adds multiple segments with a specified color to the VTK file.

Parameters
vSegmentsA vector of segments to add.
colorThe color of the segments.
bWithEndPointsWhether to include the end points in the visualization.

◆ addTriangle() [1/2]

void GEOM_FADE2D::VtkWriter::addTriangle ( const Point2 p0,
const Point2 p1,
const Point2 p2,
VtkColor  color 
)

Adds a triangle defined by three points with a specified color to the VTK file.

Parameters
p0The first point defining the triangle.
p1The second point defining the triangle.
p2The third point defining the triangle.
colorThe color of the triangle.

◆ addTriangle() [2/2]

void GEOM_FADE2D::VtkWriter::addTriangle ( const Triangle2 t,
VtkColor  color 
)

Adds a single triangle with a specified color to the VTK file.

Parameters
tThe triangle to add.
colorThe color of the triangle.

◆ addTriangles() [1/2]

void GEOM_FADE2D::VtkWriter::addTriangles ( const std::vector< Point2 > &  vTriangleCorners,
VtkColor  color 
)

Adds multiple triangles defined by their corner points with a specified color to the VTK file.

Parameters
vTriangleCornersA vector of points defining the corners of the triangles.
colorThe color of the triangles.

◆ addTriangles() [2/2]

void GEOM_FADE2D::VtkWriter::addTriangles ( const std::vector< Triangle2 * > &  vT,
VtkColor  color 
)

Adds multiple triangles with a specified color to the VTK file.

Parameters
vTA vector of triangle pointers to add.
colorThe color of the triangles.

◆ getNextColor()

VtkColor GEOM_FADE2D::VtkWriter::getNextColor ( )
Returns
The next VtkColor in the sequence.

◆ writeFile()

void GEOM_FADE2D::VtkWriter::writeFile ( )

Writes all accumulated data to the specified VTK file.

Note
This function finalizes the VTK file. It must be called after all geometric elements have been added.

The documentation for this class was generated from the following file: