TechDraw::DrawUtil Class Reference

Convenient utility functions for TechDraw Module. More...

#include <DrawUtil.h>

Static Public Member Functions

static double angleComposition (double fi, double delta)
 
static double angleDifference (double fi1, double fi2, bool reflex=false)
 
static void angleNormalize (double &fi)
 
static double angleWithX (TopoDS_Edge e, bool reverse)
 assumes 2d on XY quick angle for straight edges More...
 
static double angleWithX (TopoDS_Edge e, TopoDS_Vertex v, double tolerance=VERTEXTOLERANCE)
 find angle of edge with x-Axis at First/LastVertex More...
 
static std::pair< Base::Vector3d, Base::Vector3dboxIntersect2d (Base::Vector3d point, Base::Vector3d dir, double xRange, double yRange)
 
static bool checkParallel (const Base::Vector3d v1, const Base::Vector3d v2, double tolerance=FLT_EPSILON)
 check if two vectors are parallel. Vectors don't have to be unit vectors More...
 
static bool circulation (Base::Vector3d A, Base::Vector3d B, Base::Vector3d C)
 
static Base::Vector3d closestBasis (Base::Vector3d v)
 
static PyObjectcolorToPyTuple (App::Color color)
 
static void copyFile (std::string inSpec, std::string outSpec)
 
static void countEdges (const char *label, const TopoDS_Shape &s)
 
static void countFaces (const char *label, const TopoDS_Shape &s)
 
static int countSubShapes (TopoDS_Shape shape, TopAbs_ShapeEnum subShape)
 
static void countWires (const char *label, const TopoDS_Shape &s)
 
static void dump1Vertex (const char *label, const TopoDS_Vertex &v)
 
static void dumpCS (const char *text, const gp_Ax2 &CS)
 
static void dumpCS3 (const char *text, const gp_Ax3 &CS)
 
static void dumpEdge (const char *label, int i, TopoDS_Edge e)
 
static void dumpEdges (const char *text, const TopoDS_Shape &s)
 
static void dumpVertexes (const char *text, const TopoDS_Shape &s)
 
static void findCircleRectangleIntersections (const Base::Vector2d &circleCenter, double circleRadius, const Base::BoundBox2d &rectangle, std::vector< Base::Vector2d > &intersections)
 
static void findCircularArcRectangleIntersections (const Base::Vector2d &circleCenter, double circleRadius, double arcBaseAngle, double arcRotation, const Base::BoundBox2d &rectangle, std::vector< Base::Vector2d > &intersections)
 
static void findConicRectangleIntersections (double conicAx2, double conicBxy, double conicCy2, double conicDx, double conicEy, double conicF, const Base::BoundBox2d &rectangle, std::vector< Base::Vector2d > &intersections)
 
static void findLineRectangleIntersections (const Base::Vector2d &linePoint, double lineAngle, const Base::BoundBox2d &rectangle, std::vector< Base::Vector2d > &intersections)
 
static void findLineSegmentRectangleIntersections (const Base::Vector2d &linePoint, double lineAngle, double segmentBasePosition, double segmentLength, const Base::BoundBox2d &rectangle, std::vector< Base::Vector2d > &intersections)
 
static int findRootForValue (double Ax2, double Bxy, double Cy2, double Dx, double Ey, double F, double value, bool findX, double roots[])
 
static std::string formatVector (const Base::Vector3d &v)
 
static std::string formatVector (const gp_Dir &v)
 
static std::string formatVector (const gp_Dir2d &v)
 
static std::string formatVector (const gp_Pnt &v)
 
static std::string formatVector (const gp_Pnt2d &v)
 
static std::string formatVector (const gp_Vec &v)
 
static std::string formatVector (const QPointF &v)
 
static bool fpCompare (const double &d1, const double &d2, double tolerance=FLT_EPSILON)
 
static double getDefaultLineWeight (std::string s)
 
static Base::Vector3d getFaceCenter (TopoDS_Face f)
 
static std::string getGeomTypeFromName (std::string geomName)
 
static int getIndexFromName (std::string geomName)
 
static Base::Vector3d gpPnt2V3 (const gp_Pnt gp)
 
static Base::Vector2d Intersect2d (Base::Vector2d p1, Base::Vector2d d1, Base::Vector2d p2, Base::Vector2d d2)
 
static Base::Vector3d Intersect2d (Base::Vector3d p1, Base::Vector3d d1, Base::Vector3d p2, Base::Vector3d d2)
 find intersection in 2d for 2 lines in point+direction form More...
 
static void intervalMarkCircular (std::vector< std::pair< double, bool > > &marking, double start, double length, bool value)
 
static void intervalMarkLinear (std::vector< std::pair< double, bool > > &marking, double start, double length, bool value)
 
static unsigned int intervalMerge (std::vector< std::pair< double, bool > > &marking, double boundary, bool wraps)
 
static Base::Vector3d invertY (Base::Vector3d v)
 
static QPointF invertY (QPointF p)
 
static bool isBetween (const Base::Vector3d pt, const Base::Vector3d end1, const Base::Vector3d end2)
 is pt between end1 and end2? More...
 
static bool isCrazy (TopoDS_Edge e)
 
static bool isFirstVert (TopoDS_Edge e, TopoDS_Vertex v, double tolerance=VERTEXTOLERANCE)
 
static bool isLastVert (TopoDS_Edge e, TopoDS_Vertex v, double tolerance=VERTEXTOLERANCE)
 
static bool isSamePoint (TopoDS_Vertex v1, TopoDS_Vertex v2, double tolerance=VERTEXTOLERANCE)
 true if v1 and v2 are the same geometric point within tolerance More...
 
static bool isZeroEdge (TopoDS_Edge e, double tolerance=VERTEXTOLERANCE)
 
static std::string makeGeomName (std::string geomType, int index)
 
static bool mergeBoundedPoint (const Base::Vector2d &point, const Base::BoundBox2d &boundary, std::vector< Base::Vector2d > &storage)
 
static const char * printBool (bool b)
 
static App::Color pyTupleToColor (PyObject *pColor)
 
static QString qbaToDebug (const QByteArray &line)
 
static double sensibleScale (double working_scale)
 
static int sgn (double x)
 
static TopoDS_Shape shapeFromString (std::string s)
 
static std::string shapeToString (TopoDS_Shape s)
 
static double simpleMinDist (TopoDS_Shape s1, TopoDS_Shape s2)
 
static std::vector< std::string > split (std::string csvLine)
 
static double sqr (double x)
 
static std::vector< std::string > tokenize (std::string csvLine, std::string delimiter=",$$$,")
 
static Base::Vector3d toR3 (const gp_Ax2 &fromSystem, const Base::Vector3d &fromPoint)
 convert fromPoint in coordinate system fromSystem to reference coordinate system More...
 
static gp_Pnt V32gpPnt (const Base::Vector3d v)
 
static Base::Vector3d vecRotate (Base::Vector3d vec, double angle, Base::Vector3d axis, Base::Vector3d org=Base::Vector3d(0.0, 0.0, 0.0))
 rotate vector by angle radians around axis through org More...
 
static bool vectorLess (const Base::Vector3d &v1, const Base::Vector3d &v2)
 compare 2 vectors for sorting - true if v1 < v2 More...
 
static TopoDS_Shape vectorToCompound (std::vector< TopoDS_Edge > vecIn)
 
static Base::Vector3d vertex2Vector (const TopoDS_Vertex &v)
 

Detailed Description

Convenient utility functions for TechDraw Module.

Member Function Documentation

◆ angleComposition()

double DrawUtil::angleComposition ( double  fi,
double  delta 
)
static

References angleNormalize().

◆ angleDifference()

double DrawUtil::angleDifference ( double  fi1,
double  fi2,
bool  reflex = false 
)
static

References angleNormalize().

◆ angleNormalize()

void DrawUtil::angleNormalize ( double &  fi)
static

◆ angleWithX() [1/2]

double DrawUtil::angleWithX ( TopoDS_Edge  e,
bool  reverse 
)
static

◆ angleWithX() [2/2]

double DrawUtil::angleWithX ( TopoDS_Edge  e,
TopoDS_Vertex  v,
double  tolerance = VERTEXTOLERANCE 
)
static

◆ boxIntersect2d()

◆ checkParallel()

bool DrawUtil::checkParallel ( const Base::Vector3d  v1,
const Base::Vector3d  v2,
double  tolerance = FLT_EPSILON 
)
static

◆ circulation()

bool DrawUtil::circulation ( Base::Vector3d  A,
Base::Vector3d  B,
Base::Vector3d  C 
)
static

◆ closestBasis()

Base::Vector3d DrawUtil::closestBasis ( Base::Vector3d  v)
static

◆ colorToPyTuple()

PyObject * DrawUtil::colorToPyTuple ( App::Color  color)
static

◆ copyFile()

◆ countEdges()

void DrawUtil::countEdges ( const char *  label,
const TopoDS_Shape &  s 
)
static

◆ countFaces()

void DrawUtil::countFaces ( const char *  label,
const TopoDS_Shape &  s 
)
static

◆ countSubShapes()

int DrawUtil::countSubShapes ( TopoDS_Shape  shape,
TopAbs_ShapeEnum  subShape 
)
static

◆ countWires()

void DrawUtil::countWires ( const char *  label,
const TopoDS_Shape &  s 
)
static

◆ dump1Vertex()

void DrawUtil::dump1Vertex ( const char *  label,
const TopoDS_Vertex &  v 
)
static

◆ dumpCS()

void DrawUtil::dumpCS ( const char *  text,
const gp_Ax2 &  CS 
)
static

◆ dumpCS3()

void DrawUtil::dumpCS3 ( const char *  text,
const gp_Ax3 &  CS 
)
static

◆ dumpEdge()

void DrawUtil::dumpEdge ( const char *  label,
int  i,
TopoDS_Edge  e 
)
static

◆ dumpEdges()

void DrawUtil::dumpEdges ( const char *  text,
const TopoDS_Shape &  s 
)
static

◆ dumpVertexes()

void DrawUtil::dumpVertexes ( const char *  text,
const TopoDS_Shape &  s 
)
static

◆ findCircleRectangleIntersections()

void DrawUtil::findCircleRectangleIntersections ( const Base::Vector2d circleCenter,
double  circleRadius,
const Base::BoundBox2d rectangle,
std::vector< Base::Vector2d > &  intersections 
)
static

◆ findCircularArcRectangleIntersections()

void DrawUtil::findCircularArcRectangleIntersections ( const Base::Vector2d circleCenter,
double  circleRadius,
double  arcBaseAngle,
double  arcRotation,
const Base::BoundBox2d rectangle,
std::vector< Base::Vector2d > &  intersections 
)
static

◆ findConicRectangleIntersections()

void DrawUtil::findConicRectangleIntersections ( double  conicAx2,
double  conicBxy,
double  conicCy2,
double  conicDx,
double  conicEy,
double  conicF,
const Base::BoundBox2d rectangle,
std::vector< Base::Vector2d > &  intersections 
)
static

◆ findLineRectangleIntersections()

void DrawUtil::findLineRectangleIntersections ( const Base::Vector2d linePoint,
double  lineAngle,
const Base::BoundBox2d rectangle,
std::vector< Base::Vector2d > &  intersections 
)
static

◆ findLineSegmentRectangleIntersections()

void DrawUtil::findLineSegmentRectangleIntersections ( const Base::Vector2d linePoint,
double  lineAngle,
double  segmentBasePosition,
double  segmentLength,
const Base::BoundBox2d rectangle,
std::vector< Base::Vector2d > &  intersections 
)
static

◆ findRootForValue()

int DrawUtil::findRootForValue ( double  Ax2,
double  Bxy,
double  Cy2,
double  Dx,
double  Ey,
double  F,
double  value,
bool  findX,
double  roots[] 
)
static

References sqr().

Referenced by findConicRectangleIntersections().

◆ formatVector() [1/7]

◆ formatVector() [2/7]

std::string DrawUtil::formatVector ( const gp_Dir &  v)
static

◆ formatVector() [3/7]

std::string DrawUtil::formatVector ( const gp_Dir2d &  v)
static

◆ formatVector() [4/7]

std::string DrawUtil::formatVector ( const gp_Pnt &  v)
static

◆ formatVector() [5/7]

std::string DrawUtil::formatVector ( const gp_Pnt2d &  v)
static

◆ formatVector() [6/7]

std::string DrawUtil::formatVector ( const gp_Vec &  v)
static

◆ formatVector() [7/7]

std::string DrawUtil::formatVector ( const QPointF &  v)
static

◆ fpCompare()

bool DrawUtil::fpCompare ( const double &  d1,
const double &  d2,
double  tolerance = FLT_EPSILON 
)
static

References draftutils.utils::tolerance().

Referenced by TechDraw::BSpline::asCircle(), boxIntersect2d(), TechDraw::CenterLine::calcEndPoints(), TechDraw::CenterLine::calcEndPoints2Lines(), TechDraw::CenterLine::calcEndPoints2Points(), TechDraw::CenterLine::calcEndPointsNoRef(), checkParallel(), TechDraw::DrawViewPart::checkXDirection(), TechDraw::DrawViewDetail::detailExec(), TechDraw::edgeSortItem::edgeEqual(), TechDraw::edgeSortItem::edgeLess(), TechDraw::DrawViewDimension::execute(), TechDraw::DrawViewMulti::execute(), TechDraw::DrawViewDimension::getFormattedDimensionValue(), TechDraw::DrawViewDimension::getFormattedToleranceValues(), TechDraw::DrawProjGroupItem::getLegacyX(), TechDraw::DrawProjGroup::getRect(), TechDraw::DrawViewPart::getXDirection(), TechDraw::DrawProjGroupItem::getXDirection(), TechDraw::DrawViewSection::getXDirection(), TechDraw::DrawViewDimension::hasOverUnderTolerance(), TechDraw::DrawViewDimension::haveTolerance(), Intersect2d(), isBetween(), TechDraw::DrawViewPart::isIso(), TechDraw::BSpline::isLine(), TechDraw::DrawViewPart::makeGeometryForShape(), TechDrawGui::QGIHighlight::makeReference(), TechDraw::DrawProjGroup::onChanged(), TechDraw::DrawViewPart::onChanged(), TechDrawGui::QGILeaderLine::onLineEditFinished(), TechDraw::DrawViewSection::sectionExec(), TechDraw::DrawView::setPosition(), TechDrawGui::QGIView::setPosition(), TechDrawGui::QGTracker::snapToAngle(), TechDrawGui::QGIView::updateView(), TechDraw::DrawView::validateScale(), and vectorLess().

◆ getDefaultLineWeight()

double DrawUtil::getDefaultLineWeight ( std::string  s)
static

◆ getFaceCenter()

Base::Vector3d DrawUtil::getFaceCenter ( TopoDS_Face  f)
static

◆ getGeomTypeFromName()

◆ getIndexFromName()

◆ gpPnt2V3()

static Base::Vector3d TechDraw::DrawUtil::gpPnt2V3 ( const gp_Pnt  gp)
static

◆ Intersect2d() [1/2]

◆ Intersect2d() [2/2]

Base::Vector3d DrawUtil::Intersect2d ( Base::Vector3d  p1,
Base::Vector3d  d1,
Base::Vector3d  p2,
Base::Vector3d  d2 
)
static

find intersection in 2d for 2 lines in point+direction form

References Base::Console(), fpCompare(), Base::ConsoleSingleton::Message(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.

◆ intervalMarkCircular()

void DrawUtil::intervalMarkCircular ( std::vector< std::pair< double, bool > > &  marking,
double  start,
double  length,
bool  value 
)
static

◆ intervalMarkLinear()

void DrawUtil::intervalMarkLinear ( std::vector< std::pair< double, bool > > &  marking,
double  start,
double  length,
bool  value 
)
static

References intervalMerge().

◆ intervalMerge()

unsigned int DrawUtil::intervalMerge ( std::vector< std::pair< double, bool > > &  marking,
double  boundary,
bool  wraps 
)
static

◆ invertY() [1/2]

◆ invertY() [2/2]

QPointF DrawUtil::invertY ( QPointF  p)
static

◆ isBetween()

bool DrawUtil::isBetween ( const Base::Vector3d  pt,
const Base::Vector3d  end1,
const Base::Vector3d  end2 
)
static

is pt between end1 and end2?

References fpCompare().

Referenced by TechDraw::DrawViewDimension::execute().

◆ isCrazy()

◆ isFirstVert()

bool DrawUtil::isFirstVert ( TopoDS_Edge  e,
TopoDS_Vertex  v,
double  tolerance = VERTEXTOLERANCE 
)
static

◆ isLastVert()

bool DrawUtil::isLastVert ( TopoDS_Edge  e,
TopoDS_Vertex  v,
double  tolerance = VERTEXTOLERANCE 
)
static

◆ isSamePoint()

bool DrawUtil::isSamePoint ( TopoDS_Vertex  v1,
TopoDS_Vertex  v2,
double  tolerance = VERTEXTOLERANCE 
)
static

◆ isZeroEdge()

bool DrawUtil::isZeroEdge ( TopoDS_Edge  e,
double  tolerance = VERTEXTOLERANCE 
)
static

◆ makeGeomName()

std::string DrawUtil::makeGeomName ( std::string  geomType,
int  index 
)
static

◆ mergeBoundedPoint()

bool DrawUtil::mergeBoundedPoint ( const Base::Vector2d point,
const Base::BoundBox2d boundary,
std::vector< Base::Vector2d > &  storage 
)
static

◆ printBool()

const char * DrawUtil::printBool ( bool  b)
static

◆ pyTupleToColor()

App::Color DrawUtil::pyTupleToColor ( PyObject pColor)
static

◆ qbaToDebug()

QString DrawUtil::qbaToDebug ( const QByteArray &  line)
static

◆ sensibleScale()

double DrawUtil::sensibleScale ( double  working_scale)
static

◆ sgn()

int DrawUtil::sgn ( double  x)
static

◆ shapeFromString()

TopoDS_Shape DrawUtil::shapeFromString ( std::string  s)
static

◆ shapeToString()

std::string DrawUtil::shapeToString ( TopoDS_Shape  s)
static

◆ simpleMinDist()

double DrawUtil::simpleMinDist ( TopoDS_Shape  s1,
TopoDS_Shape  s2 
)
static

◆ split()

std::vector< std::string > DrawUtil::split ( std::string  csvLine)
static

◆ sqr()

double DrawUtil::sqr ( double  x)
static

◆ tokenize()

std::vector< std::string > DrawUtil::tokenize ( std::string  csvLine,
std::string  delimiter = ",$$$," 
)
static

◆ toR3()

Base::Vector3d DrawUtil::toR3 ( const gp_Ax2 &  fromSystem,
const Base::Vector3d fromPoint 
)
static

convert fromPoint in coordinate system fromSystem to reference coordinate system

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

Referenced by TechDraw::DrawViewDetail::detailExec().

◆ V32gpPnt()

static gp_Pnt TechDraw::DrawUtil::V32gpPnt ( const Base::Vector3d  v)
static

◆ vecRotate()

Base::Vector3d DrawUtil::vecRotate ( Base::Vector3d  vec,
double  angle,
Base::Vector3d  axis,
Base::Vector3d  org = Base::Vector3d(0.0,0.0,0.0) 
)
static

rotate vector by angle radians around axis through org

References Base::Matrix4D::rotLine(), and draftgeoutils.general::vec().

Referenced by TechDraw::DrawViewSection::sectionLineEnds(), and TechDraw::DrawProjGroup::spin().

◆ vectorLess()

bool DrawUtil::vectorLess ( const Base::Vector3d v1,
const Base::Vector3d v2 
)
static

compare 2 vectors for sorting - true if v1 < v2

References fpCompare().

Referenced by TechDraw::edgeSortItem::edgeLess(), and TechDraw::DrawProjectSplit::removeDuplicateEdges().

◆ vectorToCompound()

TopoDS_Shape DrawUtil::vectorToCompound ( std::vector< TopoDS_Edge >  vecIn)
static

◆ vertex2Vector()

Base::Vector3d DrawUtil::vertex2Vector ( const TopoDS_Vertex &  v)
static

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