IFCCurve.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file IFCProfile.cpp
  34. * @brief Read profile and curves entities from IFC files
  35. */
  36. #include "AssimpPCH.h"
  37. #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
  38. #include "IFCUtil.h"
  39. namespace Assimp {
  40. namespace IFC {
  41. namespace {
  42. // --------------------------------------------------------------------------------
  43. // Conic is the base class for Circle and Ellipse
  44. // --------------------------------------------------------------------------------
  45. class Conic : public Curve
  46. {
  47. public:
  48. // --------------------------------------------------
  49. Conic(const IfcConic& entity, ConversionData& conv)
  50. : Curve(entity,conv)
  51. {
  52. IfcMatrix4 trafo;
  53. ConvertAxisPlacement(trafo,*entity.Position,conv);
  54. // for convenience, extract the matrix rows
  55. location = IfcVector3(trafo.a4,trafo.b4,trafo.c4);
  56. p[0] = IfcVector3(trafo.a1,trafo.b1,trafo.c1);
  57. p[1] = IfcVector3(trafo.a2,trafo.b2,trafo.c2);
  58. p[2] = IfcVector3(trafo.a3,trafo.b3,trafo.c3);
  59. }
  60. public:
  61. // --------------------------------------------------
  62. bool IsClosed() const {
  63. return true;
  64. }
  65. // --------------------------------------------------
  66. size_t EstimateSampleCount(IfcFloat a, IfcFloat b) const {
  67. ai_assert(InRange(a) && InRange(b));
  68. a = fmod(a,static_cast<IfcFloat>( 360. ));
  69. b = fmod(b,static_cast<IfcFloat>( 360. ));
  70. return static_cast<size_t>( abs(ceil(( b-a)) / conv.settings.conicSamplingAngle) );
  71. }
  72. // --------------------------------------------------
  73. ParamRange GetParametricRange() const {
  74. return std::make_pair(static_cast<IfcFloat>( 0. ), static_cast<IfcFloat>( 360. ));
  75. }
  76. protected:
  77. IfcVector3 location, p[3];
  78. };
  79. // --------------------------------------------------------------------------------
  80. // Circle
  81. // --------------------------------------------------------------------------------
  82. class Circle : public Conic
  83. {
  84. public:
  85. // --------------------------------------------------
  86. Circle(const IfcCircle& entity, ConversionData& conv)
  87. : Conic(entity,conv)
  88. , entity(entity)
  89. {
  90. }
  91. public:
  92. // --------------------------------------------------
  93. IfcVector3 Eval(IfcFloat u) const {
  94. u = -conv.angle_scale * u;
  95. return location + static_cast<IfcFloat>(entity.Radius)*(static_cast<IfcFloat>(::cos(u))*p[0] +
  96. static_cast<IfcFloat>(::sin(u))*p[1]);
  97. }
  98. private:
  99. const IfcCircle& entity;
  100. };
  101. // --------------------------------------------------------------------------------
  102. // Ellipse
  103. // --------------------------------------------------------------------------------
  104. class Ellipse : public Conic
  105. {
  106. public:
  107. // --------------------------------------------------
  108. Ellipse(const IfcEllipse& entity, ConversionData& conv)
  109. : Conic(entity,conv)
  110. , entity(entity)
  111. {
  112. }
  113. public:
  114. // --------------------------------------------------
  115. IfcVector3 Eval(IfcFloat u) const {
  116. u = -conv.angle_scale * u;
  117. return location + static_cast<IfcFloat>(entity.SemiAxis1)*static_cast<IfcFloat>(::cos(u))*p[0] +
  118. static_cast<IfcFloat>(entity.SemiAxis2)*static_cast<IfcFloat>(::sin(u))*p[1];
  119. }
  120. private:
  121. const IfcEllipse& entity;
  122. };
  123. // --------------------------------------------------------------------------------
  124. // Line
  125. // --------------------------------------------------------------------------------
  126. class Line : public Curve
  127. {
  128. public:
  129. // --------------------------------------------------
  130. Line(const IfcLine& entity, ConversionData& conv)
  131. : Curve(entity,conv)
  132. , entity(entity)
  133. {
  134. ConvertCartesianPoint(p,entity.Pnt);
  135. ConvertVector(v,entity.Dir);
  136. }
  137. public:
  138. // --------------------------------------------------
  139. bool IsClosed() const {
  140. return false;
  141. }
  142. // --------------------------------------------------
  143. IfcVector3 Eval(IfcFloat u) const {
  144. return p + u*v;
  145. }
  146. // --------------------------------------------------
  147. size_t EstimateSampleCount(IfcFloat a, IfcFloat b) const {
  148. ai_assert(InRange(a) && InRange(b));
  149. // two points are always sufficient for a line segment
  150. return a==b ? 1 : 2;
  151. }
  152. // --------------------------------------------------
  153. void SampleDiscrete(TempMesh& out,IfcFloat a, IfcFloat b) const
  154. {
  155. ai_assert(InRange(a) && InRange(b));
  156. if (a == b) {
  157. out.verts.push_back(Eval(a));
  158. return;
  159. }
  160. out.verts.reserve(out.verts.size()+2);
  161. out.verts.push_back(Eval(a));
  162. out.verts.push_back(Eval(b));
  163. }
  164. // --------------------------------------------------
  165. ParamRange GetParametricRange() const {
  166. const IfcFloat inf = std::numeric_limits<IfcFloat>::infinity();
  167. return std::make_pair(-inf,+inf);
  168. }
  169. private:
  170. const IfcLine& entity;
  171. IfcVector3 p,v;
  172. };
  173. // --------------------------------------------------------------------------------
  174. // CompositeCurve joins multiple smaller, bounded curves
  175. // --------------------------------------------------------------------------------
  176. class CompositeCurve : public BoundedCurve
  177. {
  178. typedef std::pair< boost::shared_ptr< BoundedCurve >, bool > CurveEntry;
  179. public:
  180. // --------------------------------------------------
  181. CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv)
  182. : BoundedCurve(entity,conv)
  183. , entity(entity)
  184. , total()
  185. {
  186. curves.reserve(entity.Segments.size());
  187. BOOST_FOREACH(const IfcCompositeCurveSegment& curveSegment,entity.Segments) {
  188. // according to the specification, this must be a bounded curve
  189. boost::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv));
  190. boost::shared_ptr< BoundedCurve > bc = boost::dynamic_pointer_cast<BoundedCurve>(cv);
  191. if (!bc) {
  192. IFCImporter::LogError("expected segment of composite curve to be a bounded curve");
  193. continue;
  194. }
  195. if ( (std::string)curveSegment.Transition != "CONTINUOUS" ) {
  196. IFCImporter::LogDebug("ignoring transition code on composite curve segment, only continuous transitions are supported");
  197. }
  198. curves.push_back( CurveEntry(bc,IsTrue(curveSegment.SameSense)) );
  199. total += bc->GetParametricRangeDelta();
  200. }
  201. if (curves.empty()) {
  202. throw CurveError("empty composite curve");
  203. }
  204. }
  205. public:
  206. // --------------------------------------------------
  207. IfcVector3 Eval(IfcFloat u) const {
  208. if (curves.empty()) {
  209. return IfcVector3();
  210. }
  211. IfcFloat acc = 0;
  212. BOOST_FOREACH(const CurveEntry& entry, curves) {
  213. const ParamRange& range = entry.first->GetParametricRange();
  214. const IfcFloat delta = range.second-range.first;
  215. if (u < acc+delta) {
  216. return entry.first->Eval( entry.second ? (u-acc) + range.first : range.second-(u-acc));
  217. }
  218. acc += delta;
  219. }
  220. // clamp to end
  221. return curves.back().first->Eval(curves.back().first->GetParametricRange().second);
  222. }
  223. // --------------------------------------------------
  224. size_t EstimateSampleCount(IfcFloat a, IfcFloat b) const {
  225. ai_assert(InRange(a) && InRange(b));
  226. size_t cnt = 0;
  227. IfcFloat acc = 0;
  228. BOOST_FOREACH(const CurveEntry& entry, curves) {
  229. const ParamRange& range = entry.first->GetParametricRange();
  230. const IfcFloat delta = range.second-range.first;
  231. if (a <= acc+delta && b >= acc) {
  232. const IfcFloat at = std::max(static_cast<IfcFloat>( 0. ),a-acc), bt = std::min(delta,b-acc);
  233. cnt += entry.first->EstimateSampleCount( entry.second ? at + range.first : range.second - bt, entry.second ? bt + range.first : range.second - at );
  234. }
  235. acc += delta;
  236. }
  237. return cnt;
  238. }
  239. // --------------------------------------------------
  240. void SampleDiscrete(TempMesh& out,IfcFloat a, IfcFloat b) const
  241. {
  242. ai_assert(InRange(a) && InRange(b));
  243. const size_t cnt = EstimateSampleCount(a,b);
  244. out.verts.reserve(out.verts.size() + cnt);
  245. BOOST_FOREACH(const CurveEntry& entry, curves) {
  246. const size_t cnt = out.verts.size();
  247. entry.first->SampleDiscrete(out);
  248. if (!entry.second && cnt != out.verts.size()) {
  249. std::reverse(out.verts.begin()+cnt,out.verts.end());
  250. }
  251. }
  252. }
  253. // --------------------------------------------------
  254. ParamRange GetParametricRange() const {
  255. return std::make_pair(static_cast<IfcFloat>( 0. ),total);
  256. }
  257. private:
  258. const IfcCompositeCurve& entity;
  259. std::vector< CurveEntry > curves;
  260. IfcFloat total;
  261. };
  262. // --------------------------------------------------------------------------------
  263. // TrimmedCurve can be used to trim an unbounded curve to a bounded range
  264. // --------------------------------------------------------------------------------
  265. class TrimmedCurve : public BoundedCurve
  266. {
  267. public:
  268. // --------------------------------------------------
  269. TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv)
  270. : BoundedCurve(entity,conv)
  271. , entity(entity)
  272. , ok()
  273. {
  274. base = boost::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
  275. typedef boost::shared_ptr<const STEP::EXPRESS::DataType> Entry;
  276. // for some reason, trimmed curves can either specify a parametric value
  277. // or a point on the curve, or both. And they can even specify which of the
  278. // two representations they prefer, even though an information invariant
  279. // claims that they must be identical if both are present.
  280. // oh well.
  281. bool have_param = false, have_point = false;
  282. IfcVector3 point;
  283. BOOST_FOREACH(const Entry sel,entity.Trim1) {
  284. if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
  285. range.first = *r;
  286. have_param = true;
  287. break;
  288. }
  289. else if (const IfcCartesianPoint* const r = sel->ResolveSelectPtr<IfcCartesianPoint>(conv.db)) {
  290. ConvertCartesianPoint(point,*r);
  291. have_point = true;
  292. }
  293. }
  294. if (!have_param) {
  295. if (!have_point || !base->ReverseEval(point,range.first)) {
  296. throw CurveError("IfcTrimmedCurve: failed to read first trim parameter, ignoring curve");
  297. }
  298. }
  299. have_param = false, have_point = false;
  300. BOOST_FOREACH(const Entry sel,entity.Trim2) {
  301. if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
  302. range.second = *r;
  303. have_param = true;
  304. break;
  305. }
  306. else if (const IfcCartesianPoint* const r = sel->ResolveSelectPtr<IfcCartesianPoint>(conv.db)) {
  307. ConvertCartesianPoint(point,*r);
  308. have_point = true;
  309. }
  310. }
  311. if (!have_param) {
  312. if (!have_point || !base->ReverseEval(point,range.second)) {
  313. throw CurveError("IfcTrimmedCurve: failed to read second trim parameter, ignoring curve");
  314. }
  315. }
  316. agree_sense = IsTrue(entity.SenseAgreement);
  317. if( !agree_sense ) {
  318. std::swap(range.first,range.second);
  319. }
  320. // "NOTE In case of a closed curve, it may be necessary to increment t1 or t2
  321. // by the parametric length for consistency with the sense flag."
  322. if (base->IsClosed()) {
  323. if( range.first > range.second ) {
  324. range.second += base->GetParametricRangeDelta();
  325. }
  326. }
  327. maxval = range.second-range.first;
  328. ai_assert(maxval >= 0);
  329. }
  330. public:
  331. // --------------------------------------------------
  332. IfcVector3 Eval(IfcFloat p) const {
  333. ai_assert(InRange(p));
  334. return base->Eval( TrimParam(p) );
  335. }
  336. // --------------------------------------------------
  337. size_t EstimateSampleCount(IfcFloat a, IfcFloat b) const {
  338. ai_assert(InRange(a) && InRange(b));
  339. return base->EstimateSampleCount(TrimParam(a),TrimParam(b));
  340. }
  341. // --------------------------------------------------
  342. ParamRange GetParametricRange() const {
  343. return std::make_pair(static_cast<IfcFloat>( 0. ),maxval);
  344. }
  345. private:
  346. // --------------------------------------------------
  347. IfcFloat TrimParam(IfcFloat f) const {
  348. return agree_sense ? f + range.first : range.second - f;
  349. }
  350. private:
  351. const IfcTrimmedCurve& entity;
  352. ParamRange range;
  353. IfcFloat maxval;
  354. bool agree_sense;
  355. bool ok;
  356. boost::shared_ptr<const Curve> base;
  357. };
  358. // --------------------------------------------------------------------------------
  359. // PolyLine is a 'curve' defined by linear interpolation over a set of discrete points
  360. // --------------------------------------------------------------------------------
  361. class PolyLine : public BoundedCurve
  362. {
  363. public:
  364. // --------------------------------------------------
  365. PolyLine(const IfcPolyline& entity, ConversionData& conv)
  366. : BoundedCurve(entity,conv)
  367. , entity(entity)
  368. {
  369. points.reserve(entity.Points.size());
  370. IfcVector3 t;
  371. BOOST_FOREACH(const IfcCartesianPoint& cp, entity.Points) {
  372. ConvertCartesianPoint(t,cp);
  373. points.push_back(t);
  374. }
  375. }
  376. public:
  377. // --------------------------------------------------
  378. IfcVector3 Eval(IfcFloat p) const {
  379. ai_assert(InRange(p));
  380. const size_t b = static_cast<size_t>(floor(p));
  381. if (b == points.size()-1) {
  382. return points.back();
  383. }
  384. const IfcFloat d = p-static_cast<IfcFloat>(b);
  385. return points[b+1] * d + points[b] * (static_cast<IfcFloat>( 1. )-d);
  386. }
  387. // --------------------------------------------------
  388. size_t EstimateSampleCount(IfcFloat a, IfcFloat b) const {
  389. ai_assert(InRange(a) && InRange(b));
  390. return static_cast<size_t>( ceil(b) - floor(a) );
  391. }
  392. // --------------------------------------------------
  393. ParamRange GetParametricRange() const {
  394. return std::make_pair(static_cast<IfcFloat>( 0. ),static_cast<IfcFloat>(points.size()-1));
  395. }
  396. private:
  397. const IfcPolyline& entity;
  398. std::vector<IfcVector3> points;
  399. };
  400. } // anon
  401. // ------------------------------------------------------------------------------------------------
  402. Curve* Curve :: Convert(const IFC::IfcCurve& curve,ConversionData& conv)
  403. {
  404. if(curve.ToPtr<IfcBoundedCurve>()) {
  405. if(const IfcPolyline* c = curve.ToPtr<IfcPolyline>()) {
  406. return new PolyLine(*c,conv);
  407. }
  408. if(const IfcTrimmedCurve* c = curve.ToPtr<IfcTrimmedCurve>()) {
  409. return new TrimmedCurve(*c,conv);
  410. }
  411. if(const IfcCompositeCurve* c = curve.ToPtr<IfcCompositeCurve>()) {
  412. return new CompositeCurve(*c,conv);
  413. }
  414. //if(const IfcBSplineCurve* c = curve.ToPtr<IfcBSplineCurve>()) {
  415. // return new BSplineCurve(*c,conv);
  416. //}
  417. }
  418. if(curve.ToPtr<IfcConic>()) {
  419. if(const IfcCircle* c = curve.ToPtr<IfcCircle>()) {
  420. return new Circle(*c,conv);
  421. }
  422. if(const IfcEllipse* c = curve.ToPtr<IfcEllipse>()) {
  423. return new Ellipse(*c,conv);
  424. }
  425. }
  426. if(const IfcLine* c = curve.ToPtr<IfcLine>()) {
  427. return new Line(*c,conv);
  428. }
  429. // XXX OffsetCurve2D, OffsetCurve3D not currently supported
  430. return NULL;
  431. }
  432. #ifdef _DEBUG
  433. // ------------------------------------------------------------------------------------------------
  434. bool Curve :: InRange(IfcFloat u) const
  435. {
  436. const ParamRange range = GetParametricRange();
  437. if (IsClosed()) {
  438. ai_assert(range.first != std::numeric_limits<IfcFloat>::infinity() && range.second != std::numeric_limits<IfcFloat>::infinity());
  439. u = range.first + fmod(u-range.first,range.second-range.first);
  440. }
  441. return u >= range.first && u <= range.second;
  442. }
  443. #endif
  444. // ------------------------------------------------------------------------------------------------
  445. IfcFloat Curve :: GetParametricRangeDelta() const
  446. {
  447. const ParamRange& range = GetParametricRange();
  448. return range.second - range.first;
  449. }
  450. // ------------------------------------------------------------------------------------------------
  451. size_t Curve :: EstimateSampleCount(IfcFloat a, IfcFloat b) const
  452. {
  453. ai_assert(InRange(a) && InRange(b));
  454. // arbitrary default value, deriving classes should supply better suited values
  455. return 16;
  456. }
  457. // ------------------------------------------------------------------------------------------------
  458. IfcFloat RecursiveSearch(const Curve* cv, const IfcVector3& val, IfcFloat a, IfcFloat b, unsigned int samples, IfcFloat threshold, unsigned int recurse = 0, unsigned int max_recurse = 15)
  459. {
  460. ai_assert(samples>1);
  461. const IfcFloat delta = (b-a)/samples, inf = std::numeric_limits<IfcFloat>::infinity();
  462. IfcFloat min_point[2] = {a,b}, min_diff[2] = {inf,inf};
  463. IfcFloat runner = a;
  464. for (unsigned int i = 0; i < samples; ++i, runner += delta) {
  465. const IfcFloat diff = (cv->Eval(runner)-val).SquareLength();
  466. if (diff < min_diff[0]) {
  467. min_diff[1] = min_diff[0];
  468. min_point[1] = min_point[0];
  469. min_diff[0] = diff;
  470. min_point[0] = runner;
  471. }
  472. else if (diff < min_diff[1]) {
  473. min_diff[1] = diff;
  474. min_point[1] = runner;
  475. }
  476. }
  477. ai_assert(min_diff[0] != inf && min_diff[1] != inf);
  478. if ( fabs(a-min_point[0]) < threshold || recurse >= max_recurse) {
  479. return min_point[0];
  480. }
  481. // fix for closed curves to take their wrap-over into account
  482. if (cv->IsClosed() && fabs(min_point[0]-min_point[1]) > cv->GetParametricRangeDelta()*0.5 ) {
  483. const Curve::ParamRange& range = cv->GetParametricRange();
  484. const IfcFloat wrapdiff = (cv->Eval(range.first)-val).SquareLength();
  485. if (wrapdiff < min_diff[0]) {
  486. const IfcFloat t = min_point[0];
  487. min_point[0] = min_point[1] > min_point[0] ? range.first : range.second;
  488. min_point[1] = t;
  489. }
  490. }
  491. return RecursiveSearch(cv,val,min_point[0],min_point[1],samples,threshold,recurse+1,max_recurse);
  492. }
  493. // ------------------------------------------------------------------------------------------------
  494. bool Curve :: ReverseEval(const IfcVector3& val, IfcFloat& paramOut) const
  495. {
  496. // note: the following algorithm is not guaranteed to find the 'right' parameter value
  497. // in all possible cases, but it will always return at least some value so this function
  498. // will never fail in the default implementation.
  499. // XXX derive threshold from curve topology
  500. const IfcFloat threshold = 1e-4f;
  501. const unsigned int samples = 16;
  502. const ParamRange& range = GetParametricRange();
  503. paramOut = RecursiveSearch(this,val,range.first,range.second,samples,threshold);
  504. return true;
  505. }
  506. // ------------------------------------------------------------------------------------------------
  507. void Curve :: SampleDiscrete(TempMesh& out,IfcFloat a, IfcFloat b) const
  508. {
  509. ai_assert(InRange(a) && InRange(b));
  510. const size_t cnt = std::max(static_cast<size_t>(0),EstimateSampleCount(a,b));
  511. out.verts.reserve( out.verts.size() + cnt );
  512. IfcFloat p = a, delta = (b-a)/cnt;
  513. for(size_t i = 0; i < cnt; ++i, p += delta) {
  514. out.verts.push_back(Eval(p));
  515. }
  516. }
  517. // ------------------------------------------------------------------------------------------------
  518. bool BoundedCurve :: IsClosed() const
  519. {
  520. return false;
  521. }
  522. // ------------------------------------------------------------------------------------------------
  523. void BoundedCurve :: SampleDiscrete(TempMesh& out) const
  524. {
  525. const ParamRange& range = GetParametricRange();
  526. ai_assert(range.first != std::numeric_limits<IfcFloat>::infinity() && range.second != std::numeric_limits<IfcFloat>::infinity());
  527. return SampleDiscrete(out,range.first,range.second);
  528. }
  529. } // IFC
  530. } // Assimp
  531. #endif // ASSIMP_BUILD_NO_IFC_IMPORTER