///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
// All rights reserved.
//
// This software and its documentation and related materials are owned by
// the Alliance. The software may only be incorporated into application
// programs owned by members of the Alliance, subject to a signed
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable
// trade secrets of the Alliance and its suppliers. The software is also
// protected by copyright law and international treaty provisions. Application
// programs incorporating this software must include the following statement
// with their copyright notices:
//
// This application incorporates Open Design Alliance software pursuant to a license
// agreement with Open Design Alliance.
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
// All rights reserved.
//
// By use of this software, its documentation or related materials, you
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
#ifndef _ODTV_VIEWPORT3DCLIPBOUNDARY_H_INCLUDED_
#define _ODTV_VIEWPORT3DCLIPBOUNDARY_H_INCLUDED_
#include "Tv.h"
#include "TvSectionGeometryOutput.h"
#include "IntArray.h"
/** \details
Base class for the clip boundary information
*/
class ODTV_EXPORT OdTvClipBoundary
{
public:
/** \details
Represents clip boundary types.
*/
enum BoundaryType
{
kNormal = 0, // Default clip boundary (not pass additional data, clip outside contour)
kInverted, // Inverted clip boundary (pass inverted clip array, clip inside contour)
kExtended, // Extended clip boundary (pass clipping contours, clip by sorted contours array)
kComplex, // Complex clip boundary (extended clip boundary which requires additional preprocessing)
kPlanar // Planar clip boundary (clipping by set of 3d planes with ability to output geometry sections)
};
public:
/** \details
Default constructor for the OdTvClipBoundary class.
*/
OdTvClipBoundary() {}
/** \details
Destructor for the OdTvClipBoundary class.
*/
virtual ~OdTvClipBoundary(){}
/** \details
Returns type of the inherited boundary.
\returns
boundary type as a OdTvClipBoundary::OdTvBoundaryType value which is the OdTvClipBoundary::kNormal for this object.
*/
virtual BoundaryType type() const = 0;
/** \details
Returns cloned object.
\returns
pointer to a new OdTvClipBoundary instance.
*/
virtual OdTvClipBoundary *clone() const = 0;
};
/** \details
Class to pass normal clip boundary information.
*/
class ODTV_EXPORT OdTvNormalClipBoundary : public OdTvClipBoundary
{
public:
/** \details
Default constructor for the OdTvNormalClipBoundary class.
*/
OdTvNormalClipBoundary();
/** \details
Destructor for the OdTvInvertedClipBoundary class.
*/
virtual ~OdTvNormalClipBoundary();
/** \details
Requests the type of the inherited boundary.
\returns The boundary type represented with a value which is the OdTvClipBoundary::kNormal for this object.
*/
virtual BoundaryType type() const;
/** \details
Returns inverted clipping boundary.
\returns
array of clipping points of the inverted clipping boundary as the OdTvPoint2dArray object.
*/
const OdTvPoint2dArray& clipBoundary() const;
/** \details
Setup inverted clipping boundary.
\param pPoints [in] Input points array.
*/
void setClipBoundary(const OdTvPoint2dArray& pPoints);
/** \details
Returns the transform
\returns
Returns the transformation matrix represented as an instance of the class.
*/
const OdTvMatrix& transform() const;
/** \details
Sets a new transformation matrix for clipping boundary.
\param transform [in] A transformation matrix object.
*/
void setTransform(const OdTvMatrix& transform);
/** \details
Returns cloned object.
\returns
pointer to the cloned OdTvInvertedClipBoundary object.
*/
virtual OdTvClipBoundary* clone() const;
protected:
OdTvPoint2dArray m_Points; // Array of points that defines the clip boundary (in WCS X-Y plane).
OdTvMatrix m_Transform; // Transformation matrix.
};
/** \details
Class to pass inverted clip boundary information.
*/
class ODTV_EXPORT OdTvInvertedClipBoundary : public OdTvNormalClipBoundary
{
public:
/** \details
Default constructor for the OdTvInvertedClipBoundary class.
*/
OdTvInvertedClipBoundary();
/** \details
Destructor for the OdTvInvertedClipBoundary class.
*/
virtual ~OdTvInvertedClipBoundary();
/** \details
Returns type of the inherited boundary.
\returns The boundary type represented with a value which is the OdTvClipBoundary::kInverted for this object.
*/
virtual BoundaryType type() const;
/** \details
Returns cloned object.
\returns
pointer to the cloned OdTvInvertedClipBoundary object.
*/
virtual OdTvClipBoundary *clone() const;
};
/** \details
Class to pass extended clip boundary information.
*/
class ODTV_EXPORT OdTvExtendedClipBoundary : public OdTvNormalClipBoundary
{
public:
/** \details
Default constructor for the OdTvExtendedClipBoundary class.
*/
OdTvExtendedClipBoundary();
/** \details
Destructor for the OdTvExtendedClipBoundary class.
*/
virtual ~OdTvExtendedClipBoundary();
/** \details
Requests the type of the inherited boundary.
\returns The boundary type represented with a value which is the OdTvClipBoundary::kNormal for this object.
*/
virtual BoundaryType type() const;
/** \details
Returns extended clipping boundary contour vertices counts.
\returns
array of contour points counts.
*/
const OdIntArray &clipBoundaryCounts() const;
/** \details
Setup extended boundary contour vertices counts.
\param pCounts [in] Input counts array.
*/
void setClipBoundaryCounts(const OdIntArray &pCounts);
/** \details
Returns cloned object.
\returns
pointer to the cloned OdTvExtendedClipBoundary object.
*/
virtual OdTvClipBoundary *clone() const;
protected:
OdTvClipBoundary *copyExtendedData(OdTvExtendedClipBoundary *pNew) const;
protected:
OdIntArray m_Counts; // Array of contour points counts.
};
/** \details
Class to pass extended clip boundary information.
*/
class ODTV_EXPORT OdTvComplexClipBoundary : public OdTvExtendedClipBoundary
{
public:
/** \details
Default constructor for the OdTvComplexClipBoundary class.
*/
OdTvComplexClipBoundary();
/** \details
Destructor for the OdTvComplexClipBoundary class.
*/
virtual ~OdTvComplexClipBoundary();
/** \details
Requests the type of the inherited boundary.
\returns The boundary type represented with a value which is the OdTvClipBoundary::kNormal for this object.
*/
virtual BoundaryType type() const;
/** \details
Returns cloned object.
\returns
pointer to the cloned OdTvComplexClipBoundary object.
*/
virtual OdTvClipBoundary *clone() const;
};
/** \details
Class to pass planar clip boundary information.
*/
class ODTV_EXPORT OdTvPlanarClipBoundary : public OdTvClipBoundary
{
public:
/** \details
Describes a clipping plane.
*/
struct ClipPlane
{
/**Plane's origin point. WCS*/
OdTvPoint m_origin;
/**Plane's normal vector. WCS*/
OdTvVector m_normal;
/** \details
Default constructor for the ClipPlane struct.
*/
ClipPlane() {}
/** \details
Constructor for the ClipPlane struct. Creates structure with the specified origin point and normal to the clipping plane.
\param origin [in] Origin point.
\param normal [in] Normal to the clipping plane.
*/
ClipPlane(const OdTvPoint &origin, const OdTvVector &normal)
: m_origin(origin), m_normal(normal) {}
/** \details
Sets origin point for this clipping plane.
\param origin [in] Origin point.
\returns
reference to a clipping plane.
*/
ClipPlane &setOrigin(const OdTvPoint &origin) { m_origin = origin; return *this; }
/** \details
Retrieves the origin point of this clipping plane.
\returns
origin point.
*/
const OdTvPoint &origin() const { return m_origin; }
/** \details
Sets normal vector for this clipping plane.
\param normal [in] Normal to this clipping plane.
\returns
reference to a clipping plane.
*/
ClipPlane &setNormal(const OdTvVector &normal) { m_normal = normal; return *this; }
/** \details
Retrieves the normal to this clipping plane.
\returns
normal to this clipping plane.
*/
const OdTvVector &normal() const { return m_normal; }
};
/** \details
Defines the type of array of clipping planes.
*/
typedef OdArray ClipPlaneArray;
public:
/** \details
Default constructor for the OdTvPlanarClipBoundary class.
*/
OdTvPlanarClipBoundary();
/** \details
Destructor for the OdTvPlanarClipBoundary class.
*/
virtual ~OdTvPlanarClipBoundary();
/** \details
Requests the type of the inherited boundary.
\returns The boundary type represented with a value which is the OdTvClipBoundary::kPlanar for this object.
*/
virtual BoundaryType type() const;
/** \details
Returns array of clipping planes.
\returns
array that may contain multiple clipping planes.
*/
const ClipPlaneArray &clipPlanes() const;
/** \details
Setup array of clipping planes.
\param pClipPlanes [in] Input array of clipping planes.
*/
void setClipPlanes(const ClipPlaneArray &pClipPlanes);
/** \details
Returns optional clipping section geometry output.
\returns
Optional geometry sections output.
*/
OdTvSectionGeometryOutputPtr sectionGeometryOutput() const;
/** \details
Setup optional clipping section geometry output.
\param pSectionOutput [in] Input pointer onto section geometry output.
*/
void setSectionGeometryOutput(OdTvSectionGeometryOutputPtr pSectionOutput);
/** \details
Returns optional cut geometry output.
\returns
optional cut geometry output.
*/
OdTvCuttedGeometryOutputPtr cuttedGeometryOutput() const;
/** \details
Setup optional cut geometry output.
\param pCuttedOutput [in] Input pointer onto cut geometry output.
*/
void setCuttedGeometryOutput(OdTvCuttedGeometryOutputPtr pCuttedOutput);
/** \details
Returns cloned object.
\returns
pointer to a new OdTvClipBoundary instance.
*/
virtual OdTvClipBoundary *clone() const;
protected:
ClipPlaneArray m_ClipPlanes; // Array of clipping planes.
mutable OdTvSectionGeometryOutputPtr m_pSectionOutput; // Optional geometry sections output.
mutable OdTvCuttedGeometryOutputPtr m_pCuttedOutput; // Optional cut geometry output.
};
#endif // _ODTV_VIEWPORT3DCLIPBOUNDARY_H_INCLUDED_