CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FMGiTools.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23#ifndef _ODGITOOLS_INCLUDED_
24#define _ODGITOOLS_INCLUDED_
25
26#include "Gi/GiWorldDraw.h"
27#include "Ge/GeCircArc2d.h"
28#include "Ge/GeLineSeg2d.h"
29
30namespace OdGiTools {
31
32 inline void polyline2d( OdGiGeometry& geom,
33 int n, const OdGePoint2d* pts, double z = 0.0 )
34 {
35 OdGePoint3dArray pts3d(n);
36 while(n--) {
37 pts3d.append()->set( pts->x, pts->y, z );
38 ++pts;
39 }
40 geom.polyline( pts3d.size(), pts3d.getPtr() );
41 }
42
43 inline void arc2d( OdGiGeometry& geom,
44 const OdGePoint2d& p1,
45 const OdGePoint2d& p2,
46 const OdGePoint2d& p3,
47 double z = 0.0
48 )
49 {
50 OdGePoint3d pp1, pp2, pp3;
51 pp1.set( p1.x, p1.y, z );
52 pp2.set( p2.x, p2.y, z );
53 pp3.set( p3.x, p3.y, z );
54 geom.circularArc(pp1, pp2, pp3);
55 }
56
57 inline void arc2d( OdGiGeometry& geom,
58 const OdGeCircArc2d& arc,
59 double z = 0.0 )
60 {
61 OdGePoint2dArray pts( 3 );
62 arc.getSamplePoints( 3, pts );
63 arc2d( geom, pts[0], pts[1], pts[2], z );
64 }
65
66 inline void lineSeg2d( OdGiGeometry& geom,
67 const OdGeLineSeg2d& line,
68 double z = 0.0 )
69 {
70 OdGePoint2d pts[] = { line.startPoint(), line.endPoint() };
71 polyline2d( geom, 2, pts, z );
72 }
73
74};
75
76#endif //_ODGITOOLS_INCLUDED_
size_type size() const
Definition: OdArray.h:1247
const T * getPtr() const
Definition: OdArray.h:1600
size_type append(const T &value)
Definition: OdArray.h:1725
void getSamplePoints(double fromParam, double toParam, double approxEps, OdGePoint2dArray &pointArray, OdGeDoubleArray &paramArray) const
OdGePoint2d endPoint() const
OdGePoint2d startPoint() const
double x
Definition: GePoint2d.h:409
double y
Definition: GePoint2d.h:410
OdGePoint3d & set(double xx, double yy, double zz)
Definition: GePoint3d.h:455
virtual void circularArc(const OdGePoint3d &center, double radius, const OdGeVector3d &normal, const OdGeVector3d &startVector, double sweepAngle, OdGiArcType arcType=kOdGiArcSimple)=0
virtual void polyline(OdInt32 numVertices, const OdGePoint3d *vertexList, const OdGeVector3d *pNormal=0, OdGsMarker baseSubEntMarker=-1)=0
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
void polyline2d(OdGiGeometry &geom, int n, const OdGePoint2d *pts, double z=0.0)
Definition: FMGiTools.h:32
void lineSeg2d(OdGiGeometry &geom, const OdGeLineSeg2d &line, double z=0.0)
Definition: FMGiTools.h:66
void arc2d(OdGiGeometry &geom, const OdGePoint2d &p1, const OdGePoint2d &p2, const OdGePoint2d &p3, double z=0.0)
Definition: FMGiTools.h:43