• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

  • sources
  • kde-4.12
  • kdeedu
  • kig
  • objects
bezier_imp.cc
Go to the documentation of this file.
1 // Copyright (C) 2009 Petr Gajdos <pgajdos@suse.cz> and
2 // Maurizio Paolini <paolini@dmf.unicatt.it>
3 
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 
19 #include "bezier_imp.h"
20 
21 #include "bogus_imp.h"
22 #include "line_imp.h"
23 #include "point_imp.h"
24 #include "polygon_imp.h"
25 
26 #include "../misc/common.h"
27 #include "../misc/coordinate.h"
28 #include "../misc/kigpainter.h"
29 #include "../misc/kigtransform.h"
30 
31 #include "../kig/kig_document.h"
32 #include "../kig/kig_view.h"
33 
34 #include <klocale.h>
35 
36 #include <cmath>
37 //#include <gsl/gsl_poly.h>
38 
39 /*
40  * Polynomial Bézier Curve
41  */
42 
43 BezierImp::BezierImp( const std::vector<Coordinate>& points )
44 {
45  uint npoints = points.size();
46  Coordinate centerofmassn = Coordinate( 0, 0 );
47 
48  for ( uint i = 0; i < npoints; ++i )
49  {
50  centerofmassn += points[i];
51  }
52  mpoints = points;
53  mcenterofmass = centerofmassn/npoints;
54  mnpoints = npoints;
55 }
56 
57 BezierImp::~BezierImp()
58 {
59 }
60 
61 Coordinate BezierImp::attachPoint() const
62 {
63  return mcenterofmass;
64 }
65 
66 ObjectImp* BezierImp::transform( const Transformation& t ) const
67 {
68 /*
69  * To perform affine transformation of Bezier curve is the same as transform
70  * control points and then draw Bezier curve with this control points.
71  */
72  if ( ! t.isAffine() ) /* Don't know how to do it in general so far. */
73  {
74  return new InvalidImp;
75  }
76  std::vector<Coordinate> np;
77  for ( uint i = 0; i < mpoints.size(); ++i )
78  {
79  Coordinate nc = t.apply( mpoints[i] );
80  if ( !nc.valid() )
81  return new InvalidImp;
82  np.push_back( nc );
83  }
84  return new BezierImp( np );
85 }
86 
87 void BezierImp::draw( KigPainter& p ) const
88 {
89  p.drawCurve( this );
90 }
91 
92 bool BezierImp::inRect( const Rect& r, int width, const KigWidget& w ) const
93 {
94  bool ret = false;
95  uint reduceddim = mpoints.size() - 1;
96  for ( uint i = 0; !ret && i < reduceddim; ++i )
97  {
98  SegmentImp s( mpoints[i], mpoints[i+1] );
99  ret = lineInRect( r, mpoints[i], mpoints[i+1], width, &s, w );
100  }
101  if ( !ret )
102  {
103  SegmentImp s( mpoints[reduceddim], mpoints[0] );
104  ret = lineInRect( r, mpoints[reduceddim], mpoints[0], width, &s, w );
105  }
106 
107  return ret;
108 }
109 
110 bool BezierImp::valid() const
111 {
112  if (mnpoints > 1)
113  return true;
114  else
115  return false;
116 }
117 
118 int BezierImp::numberOfProperties() const
119 {
120  return Parent::numberOfProperties() + 3;
121 }
122 
123 const QByteArrayList BezierImp::propertiesInternalNames() const
124 {
125  QByteArrayList l = Parent::propertiesInternalNames();
126  l += "bezier-number-of-control-points";
127  l += "bezier-control-polygon";
128  l += "cartesian-equation"; //on purpose, this has the same name as in LocusImp!
129  assert( l.size() == BezierImp::numberOfProperties() );
130  return l;
131 }
132 
133 const QByteArrayList BezierImp::properties() const
134 {
135  QByteArrayList l = Parent::properties();
136  l += I18N_NOOP( "Number of control points" );
137  l += I18N_NOOP( "Control polygon" );
138  l += I18N_NOOP( "Cartesian Equation" );
139  assert( l.size() == BezierImp::numberOfProperties() );
140  return l;
141 }
142 
143 const ObjectImpType* BezierImp::impRequirementForProperty( int which ) const
144 {
145  if ( which < Parent::numberOfProperties() )
146  return Parent::impRequirementForProperty( which );
147  else return BezierImp::stype();
148 }
149 
150 const char* BezierImp::iconForProperty( int which ) const
151 {
152  assert( which < BezierImp::numberOfProperties() );
153  if ( which < Parent::numberOfProperties() )
154  return Parent::iconForProperty( which );
155  else if ( which == Parent::numberOfProperties() )
156  return "en"; // number of sides
157  else if ( which == Parent::numberOfProperties() + 1 )
158  return "controlpolygon";
159  else if ( which == Parent::numberOfProperties() + 2 )
160  return "kig_text";
161  else assert( false );
162  return "";
163 }
164 
165 ObjectImp* BezierImp::property( int which, const KigDocument& w ) const
166 {
167  assert( which < BezierImp::numberOfProperties() );
168  if ( which < Parent::numberOfProperties() )
169  return Parent::property( which, w );
170  else if ( which == Parent::numberOfProperties() )
171  {
172  // number of points
173  return new IntImp( mnpoints );
174  }
175  else if ( which == Parent::numberOfProperties() + 1 )
176  {
177  // control polygon
178  return new OpenPolygonalImp( mpoints );
179  }
180  else if ( which == Parent::numberOfProperties() + 2 )
181  {
182  // cartesian equation
183  return new StringImp( cartesianEquationString( w ) );
184  }
185  else assert( false );
186  return new InvalidImp;
187 }
188 
189 const std::vector<Coordinate> BezierImp::points() const
190 {
191  return mpoints;
192 }
193 
194 uint BezierImp::npoints() const
195 {
196  return mnpoints;
197 }
198 
199 BezierImp* BezierImp::copy() const
200 {
201  return new BezierImp( mpoints );
202 }
203 
204 void BezierImp::visit( ObjectImpVisitor* vtor ) const
205 {
206  vtor->visit( this );
207 }
208 
209 bool BezierImp::equals( const ObjectImp& rhs ) const
210 {
211  // that's actually sufficient condition for equality
212  // of Bks; there are many equal Bks with distinct
213  // control points
214  return rhs.inherits( BezierImp::stype() ) &&
215  static_cast<const BezierImp&>( rhs ).points() == mpoints;
216 }
217 
218 const ObjectImpType* BezierImp::stype()
219 {
220  static const ObjectImpType B(
221  Parent::stype(), "bezier",
222  I18N_NOOP( "Bézier Curve" ),
223  I18N_NOOP( "Select this Bézier Curve" ),
224  I18N_NOOP( "Select Bézier Curve %1" ),
225  I18N_NOOP( "Remove a Bézier Curve" ),
226  I18N_NOOP( "Add a Bézier Curve" ),
227  I18N_NOOP( "Move a Bézier Curve" ),
228  I18N_NOOP( "Attach to this Bézier Curve" ),
229  I18N_NOOP( "Show a Bézier Curve" ),
230  I18N_NOOP( "Hide a Bézier Curve" )
231  );
232 
233  return &B;
234 }
235 
236 const ObjectImpType* BezierImp::stype2()
237 {
238  static const ObjectImpType B3(
239  BezierImp::stype(), "bezier_quadratic",
240  I18N_NOOP( "Bézier Quadratic" ),
241  I18N_NOOP( "Select this Bézier Quadratic" ),
242  I18N_NOOP( "Select Bézier Quadratic %1" ),
243  I18N_NOOP( "Remove a Bézier Quadratic" ),
244  I18N_NOOP( "Add a Bézier Quadratic" ),
245  I18N_NOOP( "Move a Bézier Quadratic" ),
246  I18N_NOOP( "Attach to this Bézier Quadratic" ),
247  I18N_NOOP( "Show a Bézier Quadratic" ),
248  I18N_NOOP( "Hide a Bézier Quadratic" )
249  );
250 
251  return &B3;
252 }
253 
254 const ObjectImpType* BezierImp::stype3()
255 {
256  static const ObjectImpType B4(
257  BezierImp::stype(), "bezier_cubic",
258  I18N_NOOP( "Bézier Cubic" ),
259  I18N_NOOP( "Select this Bézier Cubic" ),
260  I18N_NOOP( "Select Bézier Cubic %1" ),
261  I18N_NOOP( "Remove a Bézier Cubic" ),
262  I18N_NOOP( "Add a Bézier Cubic" ),
263  I18N_NOOP( "Move a Bézier Cubic" ),
264  I18N_NOOP( "Attach to this Bézier Cubic" ),
265  I18N_NOOP( "Show a Bézier Cubic" ),
266  I18N_NOOP( "Hide a Bézier Cubic" )
267  );
268 
269  return &B4;
270 }
271 
272 const ObjectImpType* BezierImp::type() const
273 {
274  uint n = mpoints.size();
275 
276  if ( n == 3 ) return BezierImp::stype2();
277  if ( n == 4 ) return BezierImp::stype3();
278  return BezierImp::stype();
279 }
280 
281 bool BezierImp::isPropertyDefinedOnOrThroughThisImp( int which ) const
282 {
283  assert( which < BezierImp::numberOfProperties() );
284  if ( which < Parent::numberOfProperties() )
285  return Parent::isPropertyDefinedOnOrThroughThisImp( which );
286  return false;
287 }
288 
289 Rect BezierImp::surroundingRect() const
290 {
291  Rect r( 0., 0., 0., 0. );
292  for ( uint i = 0; i < mpoints.size(); ++i )
293  {
294  r.setContains( mpoints[i] );
295  }
296  return r;
297 }
298 
299 bool BezierImp::contains( const Coordinate& o, int width, const KigWidget& w ) const
300 {
301  return internalContainsPoint( o, w.screenInfo().normalMiss( width ), w.document() );
302 }
303 
304 bool BezierImp::containsPoint( const Coordinate& p, const KigDocument& doc ) const
305 {
306  return internalContainsPoint( p, test_threshold, doc );
307 }
308 
309 bool BezierImp::internalContainsPoint( const Coordinate& p, double threshold, const KigDocument& doc ) const
310 {
311  double param = getParam( p, doc );
312  double dist = getDist( param, p, doc );
313  return fabs( dist ) <= threshold;
314 }
315 
316 Coordinate BezierImp::deCasteljau( unsigned int m, unsigned int k, double p ) const
317 {
318  if (m == 0) return mpoints[k];
319  assert( k + 1 <= mnpoints );
320  return (1 - p)*deCasteljau( m - 1, k, p ) + p*deCasteljau( m - 1, k + 1, p );
321 }
322 
323 const Coordinate BezierImp::getPoint( double p, const KigDocument& doc ) const
324 {
325  /*
326  * Algorithm de Casteljau
327  */
328  doc.mcachedparam = p;
329  return deCasteljau( mpoints.size() - 1, 0, p );
330 }
331 
332 /*
333  * Rational Bézier Curve
334  */
335 
336 RationalBezierImp::RationalBezierImp( const std::vector<Coordinate>& points, const std::vector<double>& weights )
337 {
338  uint npoints = points.size();
339  Coordinate centerofmassn = Coordinate( 0, 0 );
340  double totalweight = 0;
341 
342  assert(points.size() == weights.size());
343 
344  for ( uint i = 0; i < npoints; ++i )
345  {
346  centerofmassn += points[i];
347  totalweight += weights[i];
348  }
349  mpoints = points;
350  mweights = weights;
351  mcenterofmass = centerofmassn/totalweight;
352  mnpoints = npoints;
353 }
354 
355 RationalBezierImp::~RationalBezierImp()
356 {
357 }
358 
359 Coordinate RationalBezierImp::attachPoint() const
360 {
361  return mcenterofmass;
362 }
363 
364 ObjectImp* RationalBezierImp::transform( const Transformation& t ) const
365 {
366 /*
367  * To perform affine transformation of Bezier curve is the same as transform
368  * control points and then draw Bezier curve with this control points.
369  */
370  if ( ! t.isAffine() ) /* Don't know how to do it in general so far. */
371  {
372  return new InvalidImp;
373  }
374  std::vector<Coordinate> np;
375  for ( uint i = 0; i < mpoints.size(); ++i )
376  {
377  Coordinate nc = t.apply( mpoints[i] );
378  if ( !nc.valid() )
379  return new InvalidImp;
380  np.push_back( nc );
381  }
382  return new RationalBezierImp( np, mweights );
383 }
384 
385 void RationalBezierImp::draw( KigPainter& p ) const
386 {
387  p.drawCurve( this );
388 }
389 
390 bool RationalBezierImp::inRect( const Rect& r, int width, const KigWidget& w ) const
391 {
392  bool ret = false;
393  uint reduceddim = mpoints.size() - 1;
394  for ( uint i = 0; !ret && i < reduceddim; ++i )
395  {
396  SegmentImp s( mpoints[i], mpoints[i+1] );
397  ret = lineInRect( r, mpoints[i], mpoints[i+1], width, &s, w );
398  }
399  if ( !ret )
400  {
401  SegmentImp s( mpoints[reduceddim], mpoints[0] );
402  ret = lineInRect( r, mpoints[reduceddim], mpoints[0], width, &s, w );
403  }
404 
405  return ret;
406 }
407 
408 bool RationalBezierImp::valid() const
409 {
410  if (mnpoints > 1 && mnpoints == mweights.size())
411  return true;
412  else
413  return false;
414 }
415 
416 int RationalBezierImp::numberOfProperties() const
417 {
418  return Parent::numberOfProperties() + 3;
419 }
420 
421 const QByteArrayList RationalBezierImp::propertiesInternalNames() const
422 {
423  QByteArrayList l = Parent::propertiesInternalNames();
424  l += "bezier-number-of-control-points";
425  l += "bezier-control-polygon";
426  l += "cartesian-equation"; //on purpose, this has the same name as in LocusImp!
427  assert( l.size() == RationalBezierImp::numberOfProperties() );
428  return l;
429 }
430 
431 const QByteArrayList RationalBezierImp::properties() const
432 {
433  QByteArrayList l = Parent::properties();
434  l += I18N_NOOP( "Number of control points" );
435  l += I18N_NOOP( "Control polygon" );
436  l += I18N_NOOP( "Cartesian Equation" );
437  assert( l.size() == RationalBezierImp::numberOfProperties() );
438  return l;
439 }
440 
441 const ObjectImpType* RationalBezierImp::impRequirementForProperty( int which ) const
442 {
443  if ( which < Parent::numberOfProperties() )
444  return Parent::impRequirementForProperty( which );
445  else return RationalBezierImp::stype();
446 }
447 
448 const char* RationalBezierImp::iconForProperty( int which ) const
449 {
450  assert( which < RationalBezierImp::numberOfProperties() );
451  if ( which < Parent::numberOfProperties() )
452  return Parent::iconForProperty( which );
453  else if ( which == Parent::numberOfProperties() )
454  return "en"; // number of sides
455  else if ( which == Parent::numberOfProperties() + 1 )
456  return "controlpolygon";
457  else if ( which == Parent::numberOfProperties() + 2 )
458  return "kig_text";
459  else assert( false );
460  return "";
461 }
462 
463 ObjectImp* RationalBezierImp::property( int which, const KigDocument& w ) const
464 {
465  assert( which < RationalBezierImp::numberOfProperties() );
466  if ( which < Parent::numberOfProperties() )
467  return Parent::property( which, w );
468  else if ( which == Parent::numberOfProperties() )
469  {
470  // number of points
471  return new IntImp( mnpoints );
472  }
473  else if ( which == Parent::numberOfProperties() + 1 )
474  {
475  // control polygon
476  return new OpenPolygonalImp( mpoints );
477  }
478  else if ( which == Parent::numberOfProperties() + 2 )
479  {
480  // cartesian equation
481  return new StringImp( cartesianEquationString( w ) );
482  }
483  else assert( false );
484  return new InvalidImp;
485 }
486 
487 const std::vector<Coordinate> RationalBezierImp::points() const
488 {
489  return mpoints;
490 }
491 
492 uint RationalBezierImp::npoints() const
493 {
494  return mnpoints;
495 }
496 
497 RationalBezierImp* RationalBezierImp::copy() const
498 {
499  return new RationalBezierImp( mpoints, mweights );
500 }
501 
502 void RationalBezierImp::visit( ObjectImpVisitor* vtor ) const
503 {
504  vtor->visit( this );
505 }
506 
507 bool RationalBezierImp::equals( const ObjectImp& rhs ) const
508 {
509  // that's actually sufficient condition for equality of
510  // RBks; there are many RBks which don't have the same
511  // control points
512  return rhs.inherits( BezierImp::stype() ) &&
513  static_cast<const BezierImp&>( rhs ).points() == mpoints;
514 }
515 
516 const ObjectImpType* RationalBezierImp::stype()
517 {
518  static const ObjectImpType R(
519  Parent::stype(), "rational_bezier",
520  I18N_NOOP( "Rational Bézier Curve" ),
521  I18N_NOOP( "Select this Rational Bézier Curve" ),
522  I18N_NOOP( "Select Rational Bézier Curve %1" ),
523  I18N_NOOP( "Remove a Rational Bézier Curve" ),
524  I18N_NOOP( "Add a Rational Bézier Curve" ),
525  I18N_NOOP( "Move a Rational Bézier Curve" ),
526  I18N_NOOP( "Attach to this Rational Bézier Curve" ),
527  I18N_NOOP( "Show a Rational Bézier Curve" ),
528  I18N_NOOP( "Hide a Rational Bézier Curve" )
529  );
530 
531  return &R;
532 }
533 
534 const ObjectImpType* RationalBezierImp::stype2()
535 {
536  static const ObjectImpType R3(
537  BezierImp::stype(), "rational_bezier_quadratic",
538  I18N_NOOP( "Rational Bézier Quadratic" ),
539  I18N_NOOP( "Select this Rational Bézier Quadratic" ),
540  I18N_NOOP( "Select Rational Bézier Quadratic %1" ),
541  I18N_NOOP( "Remove a Rational Bézier Quadratic" ),
542  I18N_NOOP( "Add a Rational Bézier Quadratic" ),
543  I18N_NOOP( "Move a Rational Bézier Quadratic" ),
544  I18N_NOOP( "Attach to this Rational Bézier Quadratic" ),
545  I18N_NOOP( "Show a Rational Bézier Quadratic" ),
546  I18N_NOOP( "Hide a Rational Bézier Quadratic" )
547  );
548 
549  return &R3;
550 }
551 
552 const ObjectImpType* RationalBezierImp::stype3()
553 {
554  static const ObjectImpType R4(
555  BezierImp::stype(), "rational_bezier_cubic",
556  I18N_NOOP( "Rational Bézier Cubic" ),
557  I18N_NOOP( "Select this Rational Bézier Cubic" ),
558  I18N_NOOP( "Select Rational Bézier Cubic %1" ),
559  I18N_NOOP( "Remove a Rational Bézier Cubic" ),
560  I18N_NOOP( "Add a Rational Bézier Cubic" ),
561  I18N_NOOP( "Move a Rational Bézier Cubic" ),
562  I18N_NOOP( "Attach to this Rational Bézier Cubic" ),
563  I18N_NOOP( "Show a Rational Bézier Cubic" ),
564  I18N_NOOP( "Hide a Rational Bézier Cubic" )
565  );
566 
567  return &R4;
568 }
569 
570 const ObjectImpType* RationalBezierImp::type() const
571 {
572  uint n = mpoints.size();
573 
574  if ( n == 3 ) return RationalBezierImp::stype2();
575  if ( n == 4 ) return RationalBezierImp::stype3();
576  return RationalBezierImp::stype();
577 }
578 
579 bool RationalBezierImp::isPropertyDefinedOnOrThroughThisImp( int which ) const
580 {
581  assert( which < RationalBezierImp::numberOfProperties() );
582  if ( which < Parent::numberOfProperties() )
583  return Parent::isPropertyDefinedOnOrThroughThisImp( which );
584  return false;
585 }
586 
587 Rect RationalBezierImp::surroundingRect() const
588 {
589  Rect r( 0., 0., 0., 0. );
590  for ( uint i = 0; i < mpoints.size(); ++i )
591  {
592  r.setContains( mpoints[i] );
593  }
594  return r;
595 }
596 
597 bool RationalBezierImp::contains( const Coordinate& o, int width, const KigWidget& w ) const
598 {
599  return internalContainsPoint( o, w.screenInfo().normalMiss( width ), w.document() );
600 }
601 
602 bool RationalBezierImp::containsPoint( const Coordinate& p, const KigDocument& doc ) const
603 {
604  return internalContainsPoint( p, test_threshold, doc );
605 }
606 
607 bool RationalBezierImp::internalContainsPoint( const Coordinate& p, double threshold, const KigDocument& doc ) const
608 {
609  double param = getParam( p, doc );
610  double dist = getDist( param, p, doc );
611  return fabs( dist ) <= threshold;
612 }
613 
614 Coordinate RationalBezierImp::deCasteljauPoints( unsigned int m, unsigned int k, double p ) const
615 {
616  if (m == 0) return mpoints[k]*mweights[k];
617  assert( k + 1 <= mnpoints );
618  return (1 - p)*deCasteljauPoints( m - 1, k, p ) + p*deCasteljauPoints( m - 1, k + 1, p );
619 }
620 
621 double RationalBezierImp::deCasteljauWeights( unsigned int m, unsigned int k, double p ) const
622 {
623  if (m == 0) return mweights[k];
624  assert( k + 1 <= mnpoints );
625  return (1 - p)*deCasteljauWeights( m - 1, k, p ) + p*deCasteljauWeights( m - 1, k + 1, p );
626 }
627 
628 const Coordinate RationalBezierImp::getPoint( double p, const KigDocument& doc ) const
629 {
630  /*
631  * Algorithm de Casteljau
632  */
633  doc.mcachedparam = p;
634  return deCasteljauPoints( mpoints.size() - 1, 0, p ) / deCasteljauWeights( mweights.size() - 1, 0, p );
635 }
636 
BezierImp::attachPoint
Coordinate attachPoint() const
Returns a reference point where to attach labels; when this returns an invalidCoord then the attachme...
Definition: bezier_imp.cc:61
BezierImp
An ObjectImp representing polynomial Bézier Curve.
Definition: bezier_imp.h:31
BezierImp::draw
void draw(KigPainter &p) const
Definition: bezier_imp.cc:87
ObjectImpType
Instances of this class represent a certain ObjectImp type.
Definition: object_imp.h:95
ObjectImp::inherits
bool inherits(const ObjectImpType *t) const
Returns true if this ObjectImp inherits the ObjectImp type represented by t.
Definition: object_imp.cc:279
BezierImp::transform
ObjectImp * transform(const Transformation &) const
Return this ObjectImp, transformed by the transformation t.
Definition: bezier_imp.cc:66
RationalBezierImp::~RationalBezierImp
~RationalBezierImp()
Definition: bezier_imp.cc:355
point_imp.h
StringImp
This ObjectImp is a BogusImp containing only a string value.
Definition: bogus_imp.h:167
ScreenInfo::normalMiss
double normalMiss(int width) const
Definition: screeninfo.cc:88
KigPainter::drawCurve
void drawCurve(const CurveImp *curve)
draw a generic curve...
Definition: kigpainter.cpp:757
OpenPolygonalImp
An ObjectImp representing an open polygonal.
Definition: polygon_imp.h:157
RationalBezierImp::draw
void draw(KigPainter &p) const
Definition: bezier_imp.cc:385
BezierImp::propertiesInternalNames
const QByteArrayList propertiesInternalNames() const
Definition: bezier_imp.cc:123
polygon_imp.h
ObjectImpVisitor::visit
void visit(const ObjectImp *imp)
Definition: object_imp.cc:81
ObjectImp::impRequirementForProperty
virtual const ObjectImpType * impRequirementForProperty(int which) const
Definition: object_imp.cc:76
ObjectImp::property
virtual ObjectImp * property(int which, const KigDocument &d) const
Definition: object_imp.cc:70
BezierImp::stype3
static const ObjectImpType * stype3()
Definition: bezier_imp.cc:254
Rect
This file is part of Kig, a KDE program for Interactive Geometry...
Definition: rect.h:34
RationalBezierImp::equals
bool equals(const ObjectImp &rhs) const
Returns true if this ObjectImp is equal to rhs.
Definition: bezier_imp.cc:507
RationalBezierImp
An ObjectImp representing a rational Bézier curve.
Definition: bezier_imp.h:100
BezierImp::isPropertyDefinedOnOrThroughThisImp
bool isPropertyDefinedOnOrThroughThisImp(int which) const
Definition: bezier_imp.cc:281
CurveImp::cartesianEquationString
QString cartesianEquationString(const KigDocument &w) const
Definition: curve_imp.cc:276
RationalBezierImp::stype3
static const ObjectImpType * stype3()
Definition: bezier_imp.cc:552
BezierImp::npoints
uint npoints() const
Returns the number of control points.
Definition: bezier_imp.cc:194
BezierImp::impRequirementForProperty
const ObjectImpType * impRequirementForProperty(int which) const
Definition: bezier_imp.cc:143
RationalBezierImp::RationalBezierImp
RationalBezierImp(const std::vector< Coordinate > &points, const std::vector< double > &weights)
Constructs a rational Bézier curve.
Definition: bezier_imp.cc:336
ObjectImp::propertiesInternalNames
virtual const QByteArrayList propertiesInternalNames() const
Definition: object_imp.cc:63
RationalBezierImp::getPoint
const Coordinate getPoint(double param, const KigDocument &) const
Definition: bezier_imp.cc:628
Transformation::isAffine
bool isAffine() const
Definition: kigtransform.cpp:686
IntImp
This ObjectImp is a BogusImp containing only an int value.
Definition: bogus_imp.h:128
RationalBezierImp::impRequirementForProperty
const ObjectImpType * impRequirementForProperty(int which) const
Definition: bezier_imp.cc:441
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
RationalBezierImp::properties
const QByteArrayList properties() const
Definition: bezier_imp.cc:431
BezierImp::iconForProperty
const char * iconForProperty(int which) const
Definition: bezier_imp.cc:150
RationalBezierImp::transform
ObjectImp * transform(const Transformation &) const
Return this ObjectImp, transformed by the transformation t.
Definition: bezier_imp.cc:364
RationalBezierImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the RationalBezierImp type.
Definition: bezier_imp.cc:516
KigWidget::screenInfo
const ScreenInfo & screenInfo() const
the part of the document we're currently showing i.e.
Definition: kig_view.cpp:272
BezierImp::stype2
static const ObjectImpType * stype2()
Definition: bezier_imp.cc:236
RationalBezierImp::attachPoint
Coordinate attachPoint() const
Returns a reference point where to attach labels; when this returns an invalidCoord then the attachme...
Definition: bezier_imp.cc:359
test_threshold
const double test_threshold
Definition: common.cpp:510
ObjectImp::iconForProperty
virtual const char * iconForProperty(int which) const
Definition: object_imp.cc:187
KigPainter
KigPainter is an extended QPainter.
Definition: kigpainter.h:51
BezierImp::inRect
bool inRect(const Rect &r, int width, const KigWidget &) const
Definition: bezier_imp.cc:92
RationalBezierImp::isPropertyDefinedOnOrThroughThisImp
bool isPropertyDefinedOnOrThroughThisImp(int which) const
Definition: bezier_imp.cc:579
RationalBezierImp::contains
bool contains(const Coordinate &p, int width, const KigWidget &) const
Definition: bezier_imp.cc:597
bogus_imp.h
RationalBezierImp::iconForProperty
const char * iconForProperty(int which) const
Definition: bezier_imp.cc:448
Transformation
Class representing a transformation.
Definition: kigtransform.h:37
BezierImp::type
const ObjectImpType * type() const
Returns the lowermost ObjectImpType that this object is an instantiation of.
Definition: bezier_imp.cc:272
RationalBezierImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: bezier_imp.cc:602
BezierImp::property
ObjectImp * property(int which, const KigDocument &w) const
Definition: bezier_imp.cc:165
BezierImp::numberOfProperties
int numberOfProperties() const
Definition: bezier_imp.cc:118
BezierImp::getPoint
const Coordinate getPoint(double param, const KigDocument &) const
Definition: bezier_imp.cc:323
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
KigWidget::document
const KigDocument & document() const
Definition: kig_view.cpp:460
RationalBezierImp::propertiesInternalNames
const QByteArrayList propertiesInternalNames() const
Definition: bezier_imp.cc:421
BezierImp::~BezierImp
~BezierImp()
Definition: bezier_imp.cc:57
ObjectImp::isPropertyDefinedOnOrThroughThisImp
virtual bool isPropertyDefinedOnOrThroughThisImp(int which) const
Definition: object_imp.cc:326
BezierImp::copy
BezierImp * copy() const
Returns a copy of this ObjectImp.
Definition: bezier_imp.cc:199
Rect::setContains
void setContains(Coordinate p)
this makes sure p is in the rect, extending it if necessary...
Definition: rect.cc:240
BezierImp::contains
bool contains(const Coordinate &p, int width, const KigWidget &) const
Definition: bezier_imp.cc:299
lineInRect
bool lineInRect(const Rect &r, const Coordinate &a, const Coordinate &b, const int width, const ObjectImp *imp, const KigWidget &w)
Is the line, segment, ray or vector inside r ? We need the imp to distinguish between rays...
Definition: common.cpp:401
RationalBezierImp::npoints
uint npoints() const
Returns the number of control points.
Definition: bezier_imp.cc:492
Transformation::apply
const Coordinate apply(const double x0, const double x1, const double x2) const
Apply this Tranformation.
Definition: kigtransform.cpp:611
BezierImp::equals
bool equals(const ObjectImp &rhs) const
Returns true if this ObjectImp is equal to rhs.
Definition: bezier_imp.cc:209
BezierImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: bezier_imp.cc:304
RationalBezierImp::type
const ObjectImpType * type() const
Returns the lowermost ObjectImpType that this object is an instantiation of.
Definition: bezier_imp.cc:570
line_imp.h
BezierImp::internalContainsPoint
bool internalContainsPoint(const Coordinate &p, double threshold, const KigDocument &doc) const
Definition: bezier_imp.cc:309
BezierImp::surroundingRect
Rect surroundingRect() const
Definition: bezier_imp.cc:289
RationalBezierImp::internalContainsPoint
bool internalContainsPoint(const Coordinate &p, double threshold, const KigDocument &doc) const
Definition: bezier_imp.cc:607
RationalBezierImp::points
const std::vector< Coordinate > points() const
Returns the vector with control points.
Definition: bezier_imp.cc:487
CurveImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the CurveImp type.
Definition: curve_imp.cc:27
KigDocument
KigDocument is the class holding the real data in a Kig document.
Definition: kig_document.h:36
BezierImp::valid
bool valid() const
Definition: bezier_imp.cc:110
KigDocument::mcachedparam
double mcachedparam
Definition: kig_document.h:71
BezierImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the BezierImp type.
Definition: bezier_imp.cc:218
RationalBezierImp::copy
RationalBezierImp * copy() const
Returns a copy of this ObjectImp.
Definition: bezier_imp.cc:497
RationalBezierImp::visit
void visit(ObjectImpVisitor *vtor) const
Definition: bezier_imp.cc:502
BezierImp::points
const std::vector< Coordinate > points() const
Returns the vector with control points.
Definition: bezier_imp.cc:189
QByteArrayList
QList< QByteArray > QByteArrayList
Definition: objects/common.h:50
RationalBezierImp::property
ObjectImp * property(int which, const KigDocument &w) const
Definition: bezier_imp.cc:463
ObjectImp
The ObjectImp class represents the behaviour of an object after it is calculated. ...
Definition: object_imp.h:226
CurveImp::getDist
double getDist(double param, const Coordinate &p, const KigDocument &doc) const
This function returns the distance between the point with parameter param and point p...
Definition: curve_imp.cc:137
RationalBezierImp::valid
bool valid() const
Definition: bezier_imp.cc:408
BezierImp::properties
const QByteArrayList properties() const
Definition: bezier_imp.cc:133
RationalBezierImp::surroundingRect
Rect surroundingRect() const
Definition: bezier_imp.cc:587
RationalBezierImp::numberOfProperties
int numberOfProperties() const
Definition: bezier_imp.cc:416
RationalBezierImp::inRect
bool inRect(const Rect &r, int width, const KigWidget &) const
Definition: bezier_imp.cc:390
BezierImp::visit
void visit(ObjectImpVisitor *vtor) const
Definition: bezier_imp.cc:204
CurveImp::getParam
virtual double getParam(const Coordinate &point, const KigDocument &) const
Definition: curve_imp.cc:149
RationalBezierImp::stype2
static const ObjectImpType * stype2()
Definition: bezier_imp.cc:534
ObjectImp::numberOfProperties
virtual int numberOfProperties() const
Definition: object_imp.cc:58
uint
unsigned int uint
Definition: object_imp.h:87
Coordinate::valid
bool valid() const
Return whether this is a valid Coordinate.
Definition: coordinate.cpp:176
BezierImp::BezierImp
BezierImp(const std::vector< Coordinate > &points)
Constructs a Bézier curve.
Definition: bezier_imp.cc:43
ObjectImpVisitor
Definition: object_imp.h:56
ObjectImp::properties
virtual const QByteArrayList properties() const
Definition: object_imp.cc:51
InvalidImp
This ObjectImp represents an invalid object.
Definition: bogus_imp.h:61
bezier_imp.h
SegmentImp
An ObjectImp representing a segment.
Definition: line_imp.h:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal