查看单个帖子
旧 2009-05-06, 10:13 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】polygonwithholesou

polygonwithholesout

polygonwithholesout
is it necessary to override odgigeometrysimplifier:olygonwithholesout(..)?
if i just override polygonout(...) truetype letters with holes (e.g. e, a, o, b) are not rendered.
how can i force dd to split polygons with holes into 2 or more polygons without holes and to call only polygonout?

klaus
# 11th february 2004, 02:07 am

softdev join date: oct 2002
location: russian federation, spb
posts: 332
hi,
surely, it must not be, but seems it is... we'll fixed it.
now you should to override it and call odgigeometrysimplifier::triangulateshel() passing polygonwithholesout's params in there then you'll get a set of triangles via odgigeometrysimplifier::enumtriangles interface.

dmitry a. novikov
# 11th february 2004, 04:48 am

registered user join date: sep 2003
posts: 12

hi!
how can i convert the polygonwithholes params (oduint32 ncontours, oduint32 *pcounts) into triangulateshell params
(odint32 facelistsize, const odint32* pfacelist).
if i just cast pcounts to (odint32*) triangulateshell crashes.

klaus
# 11th february 2004, 05:46 am

softdev join date: oct 2002
location: russian federation, spb
posts: 332
hi,
i've just implemented odgigeometrysimplifier:olygonwithholesout(), so it will be available in nearest maintainence release:
code:
void odgigeometrysimplifier:olygonwithholesout(oduint32 npoints, const odgepoint3d* ppoints, oduint32 ncontours, oduint32 *pcounts)
{
class _enumtriangles : public enumtriangles
{
void operator = (const _enumtriangles& ) {}
odgigeometrysimplifier& m_target;
const odgepoint3d* m_ppoints;
odgepoint3d m_ptriangle[3];
public:
_enumtriangles(odgigeometrysimplifier& target, const odgepoint3d* ppoints)
: m_target(target)
, m_ppoints(ppoints)
{ }
void triangle( oduint32 , const odint32* ptrianglevertices, const odint32* )
{
m_ptriangle[0] = m_ppoints[*ptrianglevertices++];
m_ptriangle[1] = m_ppoints[*ptrianglevertices++];
m_ptriangle[2] = m_ppoints[*ptrianglevertices++];
m_target.polygonout(3, m_ptriangle, 0);
}
};
odint32array facelist(npoints + ncontours);
int nfacebase = 0;
facelist.push_back( *pcounts );
oduint32 j;
for ( j = 0; j < *pcounts; ++j )
facelist.push_back( j );
nfacebase = j;
for ( oduint32 i = 1; i < ncontours; ++i )
{
++pcounts;
facelist.push_back( -int(*pcounts) ); // hole
for ( j = 0; j < *pcounts; ++j )
facelist.push_back( nfacebase + j );
}
_enumtriangles enumtriangles(*this, ppoints);
triangulateshell(&enumtriangles, npoints, ppoints, facelist.size(), facelist.getptr() );
}

dmitry a. novikov
# 11th february 2004, 08:09 am

registered user join date: sep 2003
posts: 12

hi!
i think there is a problem if there are more than one hole in a polygon. e.g. the letter 'b' and '8' are rendered with only one hole. there is no "top"-hole.
i have one other problem with a dwg-file, which causes triangulateshell to runs into an endless loop.
should i send you this 1.4mb dwg-file?

klaus
# 11th february 2004, 08:25 am

softdev join date: oct 2002
location: russian federation, spb
posts: 332
thanks for the info.
the problem with endless loop triangulateshell() has been already fixed. fix will be available in nearest maintainence release.

dmitry a. novikov
# 13th february 2004, 04:39 am

softdev join date: oct 2002
location: russian federation, spb
posts: 332
hi,
the bug was in odgigeometrysimplifier:olygonwithholesout(). the next code must work fine:
code:
void odgigeometrysimplifier:olygonwithholesout(oduint32 npoints, const odgepoint3d* ppoints, oduint32 ncontours, oduint32 *pcounts)
{
class _enumtriangles : public enumtriangles
{
void operator = (const _enumtriangles& ) {}
odgigeometrysimplifier& m_target;
const odgepoint3d* m_ppoints;
odgepoint3d m_ptriangle[3];
public:
_enumtriangles(odgigeometrysimplifier& target, const odgepoint3d* ppoints)
: m_target(target)
, m_ppoints(ppoints)
{ }
void triangle( oduint32 , const odint32* ptrianglevertices, const odint32* )
{
m_ptriangle[0] = m_ppoints[*ptrianglevertices++];
m_ptriangle[1] = m_ppoints[*ptrianglevertices++];
m_ptriangle[2] = m_ppoints[*ptrianglevertices++];
m_target.polygonout(3, m_ptriangle, 0);
}
};
odint32array facelist(npoints + ncontours);
facelist.push_back( *pcounts );
oduint32 ind = 0, i, j;
for ( i = 0; i < *pcounts; ++i )
facelist.push_back( ind++ );
for ( j = 1; j < ncontours; ++j )
{
++pcounts;
facelist.push_back( -int(*pcounts) ); // hole
for ( i = 0; i < *pcounts; ++i )
facelist.push_back( ind++ );
}
_enumtriangles enumtriangles(*this, ppoints);
triangulateshell(&enumtriangles, npoints, ppoints, facelist.size(), facelist.getptr() );
}

dmitry a. novikov

none
? | ?
thread tools



display modes
linear mode


search this thread

rate this thread
excellent
good
average
bad
terrible

posting rules
you may post new threads
you may post replies
you may post attachments
you may edit your posts
is on
are on
code is off
html code is off
forum jump
user control panel private messages subscriptions who's online search forums forums home general topics news questions and remarks business issues industry commentary general software issues documentation issues future directions dwg libraries dwgdirect.net dwgdirect, c++ version dwgdirectx, activex version adtdirect/c3ddirect opendwg toolkit/viewkit dgn libraries dgndirect, c++ version (2.x+) dgndirect libraries (legacy 0.99xx)
all times are gmt -7. the time now is 01:35 amfff">.
- - -
copyright ?2000 - 2009, jelsoft enterprises ltd.
copyright 1998-2008 open design alliance inc.
hi,
surely, it must not be, but seems it is... we'll fixed it.
now you should to override it and call odgigeometrysimplifier::triangulateshel() passing polygonwithholesout's params in there then you'll get a set of triangles via odgigeometrysimplifier::enumtriangles interface.

hi!
how can i convert the polygonwithholes params (oduint32 ncontours, oduint32 *pcounts) into triangulateshell params
(odint32 facelistsize, const odint32* pfacelist).
if i just cast pcounts to (odint32*) triangulateshell crashes.
hi,
i've just implemented odgigeometrysimplifier:olygonwithholesout(), so it will be available in nearest maintainence release:
code:
void odgigeometrysimplifier:olygonwithholesout(oduint32 npoints, const odgepoint3d* ppoints, oduint32 ncontours, oduint32 *pcounts)
{
class _enumtriangles : public enumtriangles
{
void operator = (const _enumtriangles& ) {}
odgigeometrysimplifier& m_target;
const odgepoint3d* m_ppoints;
odgepoint3d m_ptriangle[3];
public:
_enumtriangles(odgigeometrysimplifier& target, const odgepoint3d* ppoints)
: m_target(target)
, m_ppoints(ppoints)
{ }
void triangle( oduint32 , const odint32* ptrianglevertices, const odint32* )
{
m_ptriangle[0] = m_ppoints[*ptrianglevertices++];
m_ptriangle[1] = m_ppoints[*ptrianglevertices++];
m_ptriangle[2] = m_ppoints[*ptrianglevertices++];
m_target.polygonout(3, m_ptriangle, 0);
}
};
odint32array facelist(npoints + ncontours);
int nfacebase = 0;
facelist.push_back( *pcounts );
oduint32 j;
for ( j = 0; j < *pcounts; ++j )
facelist.push_back( j );
nfacebase = j;
for ( oduint32 i = 1; i < ncontours; ++i )
{
++pcounts;
facelist.push_back( -int(*pcounts) ); // hole
for ( j = 0; j < *pcounts; ++j )
facelist.push_back( nfacebase + j );
}
_enumtriangles enumtriangles(*this, ppoints);
triangulateshell(&enumtriangles, npoints, ppoints, facelist.size(), facelist.getptr() );
}

hi!
i think there is a problem if there are more than one hole in a polygon. e.g. the letter 'b' and '8' are rendered with only one hole. there is no "top"-hole.
i have one other problem with a dwg-file, which causes triangulateshell to runs into an endless loop.
should i send you this 1.4mb dwg-file?
thanks for the info.
the problem with endless loop triangulateshell() has been already fixed. fix will be available in nearest maintainence release.
hi,
the bug was in odgigeometrysimplifier:olygonwithholesout(). the next code must work fine:
code:
void odgigeometrysimplifier:olygonwithholesout(oduint32 npoints, const odgepoint3d* ppoints, oduint32 ncontours, oduint32 *pcounts)
{
class _enumtriangles : public enumtriangles
{
void operator = (const _enumtriangles& ) {}
odgigeometrysimplifier& m_target;
const odgepoint3d* m_ppoints;
odgepoint3d m_ptriangle[3];
public:
_enumtriangles(odgigeometrysimplifier& target, const odgepoint3d* ppoints)
: m_target(target)
, m_ppoints(ppoints)
{ }
void triangle( oduint32 , const odint32* ptrianglevertices, const odint32* )
{
m_ptriangle[0] = m_ppoints[*ptrianglevertices++];
m_ptriangle[1] = m_ppoints[*ptrianglevertices++];
m_ptriangle[2] = m_ppoints[*ptrianglevertices++];
m_target.polygonout(3, m_ptriangle, 0);
}
};
odint32array facelist(npoints + ncontours);
facelist.push_back( *pcounts );
oduint32 ind = 0, i, j;
for ( i = 0; i < *pcounts; ++i )
facelist.push_back( ind++ );
for ( j = 1; j < ncontours; ++j )
{
++pcounts;
facelist.push_back( -int(*pcounts) ); // hole
for ( i = 0; i < *pcounts; ++i )
facelist.push_back( ind++ );
}
_enumtriangles enumtriangles(*this, ppoints);
triangulateshell(&enumtriangles, npoints, ppoints, facelist.size(), facelist.getptr() );
}
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)