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

kig

  • sources
  • kde-4.14
  • kdeedu
  • kig
  • objects
intersection_types.cc
Go to the documentation of this file.
1 // Copyright (C) 2003 Dominique Devriese <devriese@kde.org>
2 
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 // 02110-1301, USA.
17 
18 #include "intersection_types.h"
19 
20 #include <math.h>
21 
22 #include "bogus_imp.h"
23 #include "circle_imp.h"
24 #include "conic_imp.h"
25 #include "cubic_imp.h"
26 #include "line_imp.h"
27 #include "other_imp.h"
28 #include "point_imp.h"
29 
30 #include <klocale.h>
31 
32 static const char intersectlinestat[] = I18N_NOOP( "Intersect with this line" );
33 
34 static const ArgsParser::spec argsspecConicLineIntersection[] =
35 {
36  { ConicImp::stype(), I18N_NOOP( "Intersect with this conic" ),
37  "SHOULD NOT BE SEEN", true },
38  { AbstractLineImp::stype(), intersectlinestat, "SHOULD NOT BE SEEN", true },
39  { IntImp::stype(), "param", "SHOULD NOT BE SEEN", false }
40 };
41 
42 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( ConicLineIntersectionType )
43 
44 ConicLineIntersectionType::ConicLineIntersectionType()
45  : ArgsParserObjectType( "ConicLineIntersection",
46  argsspecConicLineIntersection, 3 )
47 {
48 }
49 
50 ConicLineIntersectionType::~ConicLineIntersectionType()
51 {
52 }
53 
54 const ConicLineIntersectionType* ConicLineIntersectionType::instance()
55 {
56  static const ConicLineIntersectionType t;
57  return &t;
58 }
59 
60 ObjectImp* ConicLineIntersectionType::calc( const Args& parents, const KigDocument& doc ) const
61 {
62  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
63 
64  int side = static_cast<const IntImp*>( parents[2] )->data();
65  assert( side == 1 || side == -1 );
66  const AbstractLineImp* lineimp = static_cast<const AbstractLineImp*>( parents[1] );
67  const LineData line = lineimp->data();
68 
69  Coordinate ret;
70  if ( parents[0]->inherits( CircleImp::stype() ) )
71  {
72  // easy case..
73  const CircleImp* c = static_cast<const CircleImp*>( parents[0] );
74  ret = calcCircleLineIntersect(
75  c->center(), c->squareRadius(), line, side );
76  }
77  else
78  {
79  // harder case..
80  ret = calcConicLineIntersect(
81  static_cast<const ConicImp*>( parents[0] )->cartesianData(),
82  line, 0.0, side );
83  }
84  if ( !ret.valid() ) return new InvalidImp;
85  if ( !lineimp->containsPoint( ret, doc ) ) return new InvalidImp;
86  return new PointImp( ret );
87 }
88 
89 /*
90  * This construction is authomatically invoked when the user
91  * intersects a line with a conic with one of the intersections
92  * already present. There are two positive side effects:
93  * 1. The production of coincident points is greatly reduced
94  * 2. The "other" intersection will remain the "other" one also
95  * when dynamically moving the construction, which is what the
96  * user expects
97  */
98 
99 static const ArgsParser::spec argsspecConicLineOtherIntersection[] =
100 {
101  { ConicImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", true },
102  { AbstractLineImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", true },
103  { PointImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", false }
104 };
105 
106 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( ConicLineOtherIntersectionType )
107 
108 ConicLineOtherIntersectionType::ConicLineOtherIntersectionType()
109  : ArgsParserObjectType( "ConicLineOtherIntersection",
110  argsspecConicLineOtherIntersection, 3 )
111 {
112 }
113 
114 ConicLineOtherIntersectionType::~ConicLineOtherIntersectionType()
115 {
116 }
117 
118 const ConicLineOtherIntersectionType* ConicLineOtherIntersectionType::instance()
119 {
120  static const ConicLineOtherIntersectionType t;
121  return &t;
122 }
123 
124 ObjectImp* ConicLineOtherIntersectionType::calc( const Args& parents, const KigDocument& doc ) const
125 {
126  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
127 
128  Coordinate p = static_cast<const PointImp*>( parents[2] )->coordinate();
129  const AbstractLineImp* line = static_cast<const AbstractLineImp*>( parents[1] );
130  const ConicImp* conic = static_cast<const ConicImp*>( parents[0] );
131  const LineData linedata = line->data();
132 
133  if ( !line->containsPoint( p, doc ) || !conic->containsPoint( p, doc ) )
134  {
135  return new InvalidImp;
136  }
137 
138  Coordinate ret;
139  double pax = p.x - linedata.a.x;
140  double pay = p.y - linedata.a.y;
141  double bax = linedata.b.x - linedata.a.x;
142  double bay = linedata.b.y - linedata.a.y;
143  double knownparam = (pax*bax + pay*bay)/(bax*bax + bay*bay);
144  ret = calcConicLineIntersect(
145  conic->cartesianData(),
146  linedata, knownparam, 0 );
147  if ( !ret.valid() ) return new InvalidImp;
148  if ( !line->containsPoint( ret, doc ) ) return new InvalidImp;
149  return new PointImp( ret );
150 }
151 // cubic line other intersection
152 
153 static const ArgsParser::spec argsspecCubicLineOtherIntersection[] =
154 {
155  { CubicImp::stype(), I18N_NOOP( "Intersect with this cubic"), "SHOULD NOT BE SEEN", true },
156  { AbstractLineImp::stype(), intersectlinestat , "SHOULD NOT BE SEEN", true },
157  { PointImp::stype(), I18N_NOOP( "Already computed intersection point"), "SHOULD NOT BE SEEN", true },
158  { PointImp::stype(), I18N_NOOP( "Already computed intersection point"), "SHOULD NOT BE SEEN", true }
159 };
160 
161 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( CubicLineOtherIntersectionType )
162 
163 CubicLineOtherIntersectionType::CubicLineOtherIntersectionType()
164  : ArgsParserObjectType( "CubicLineOtherIntersection",
165  argsspecCubicLineOtherIntersection, 4 )
166 {
167 }
168 
169 CubicLineOtherIntersectionType::~CubicLineOtherIntersectionType()
170 {
171 }
172 
173 const CubicLineOtherIntersectionType* CubicLineOtherIntersectionType::instance()
174 {
175  static const CubicLineOtherIntersectionType t;
176  return &t;
177 }
178 
179 ObjectImp* CubicLineOtherIntersectionType::calc( const Args& parents, const KigDocument& doc ) const
180 {
181  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
182 
183  Coordinate p = static_cast<const PointImp*>( parents[2] )->coordinate();
184  Coordinate q = static_cast<const PointImp*>( parents[3] )->coordinate();
185  const AbstractLineImp* line = static_cast<const AbstractLineImp*>( parents[1] );
186  const CubicImp* cubic = static_cast<const CubicImp*>( parents[0] );
187  const LineData linedata = line->data();
188  const CubicCartesianData cubicData = cubic->data();
189 
190  if ( !line->containsPoint( p, doc ) || !cubic->containsPoint( p, doc ) )
191  {
192  return new InvalidImp;
193  }
194  if ( !line->containsPoint( q, doc ) || !cubic->containsPoint( q, doc ) )
195  {
196  return new InvalidImp;
197  }
198  Coordinate ret;
199  double pax = p.x - linedata.a.x;
200  double pay = p.y - linedata.a.y;
201  double bax = linedata.b.x - linedata.a.x;
202  double bay = linedata.b.y - linedata.a.y;
203  double qax = q.x - linedata.a.x;
204  double qay = q.y - linedata.a.y;
205  double knownparam1 = (pax*bax + pay*bay)/(bax*bax + bay*bay);
206  double knownparam2 = (qax*bax + qay*bay)/(bax*bax + bay*bay);
207  double t, aa, bb, cc, dd;
208  calcCubicLineRestriction ( cubicData, linedata.a, linedata.b-linedata.a, aa, bb, cc, dd );
209 
210  t = - bb/aa - knownparam1 - knownparam2;
211 
212  ret = linedata.a + t*(linedata.b - linedata.a);
213 
214  if ( !ret.valid() ) return new InvalidImp;
215  // if ( !line->containsPoint( ret, doc ) ) return new InvalidImp;
216  return new PointImp( ret );
217 }
218 
219 // cubic line two intersection
220 
221 static const ArgsParser::spec argsspecCubicLineTwoIntersection[] =
222 {
223  { CubicImp::stype(), I18N_NOOP( "Intersect with this cubic"), "SHOULD NOT BE SEEN", true },
224  { AbstractLineImp::stype(), intersectlinestat , "SHOULD NOT BE SEEN", true },
225  { PointImp::stype(), I18N_NOOP( "Already computed intersection point"), "Already computed intersection point", true },
226  { IntImp::stype(), "param", "SHOULD NOT BE SEEN", false }
227 };
228 
229 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( CubicLineTwoIntersectionType )
230 
231 CubicLineTwoIntersectionType::CubicLineTwoIntersectionType()
232  : ArgsParserObjectType( "CubicLineTwoIntersection",
233  argsspecCubicLineTwoIntersection, 4 )
234 {
235 }
236 
237 CubicLineTwoIntersectionType::~CubicLineTwoIntersectionType()
238 {
239 }
240 
241 const CubicLineTwoIntersectionType* CubicLineTwoIntersectionType::instance()
242 {
243  static const CubicLineTwoIntersectionType t;
244  return &t;
245 }
246 
247 ObjectImp* CubicLineTwoIntersectionType::calc( const Args& parents, const KigDocument& doc ) const
248 {
249  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
250 
251  Coordinate p = static_cast<const PointImp*>( parents[2] )->coordinate();
252  const AbstractLineImp* line = static_cast<const AbstractLineImp*>( parents[1] );
253  const CubicImp* cubic = static_cast<const CubicImp*>( parents[0] );
254  int side = static_cast<const IntImp*>( parents[3] )->data();
255  assert( side == 1 || side == -1 );
256  const LineData linedata = line->data();
257  const CubicCartesianData cubicData = cubic->data();
258 
259  if ( !line->containsPoint( p, doc ) || !cubic->containsPoint( p, doc ) )
260  {
261  return new InvalidImp;
262  }
263 
264  Coordinate ret;
265  double pax = p.x - linedata.a.x;
266  double pay = p.y - linedata.a.y;
267  double bax = linedata.b.x - linedata.a.x;
268  double bay = linedata.b.y - linedata.a.y;
269  double knownparam = (pax*bax + pay*bay)/(bax*bax + bay*bay);
270  double t, aa, bb, cc, dd, bbb, ccc;
271  calcCubicLineRestriction ( cubicData, linedata.a, linedata.b-linedata.a, aa, bb, cc, dd );
272  bbb = bb/aa + knownparam;
273  ccc = (cc/aa) + (bb/aa*knownparam) + (knownparam*knownparam);
274 
275  double discrim = bbb*bbb - 4*ccc;
276  if (discrim < 0.0)
277  {
278  return new InvalidImp;
279  }
280  else
281  {
282  if ( side*bbb > 0 )
283  {
284  t = bbb + side*sqrt(discrim);
285  t = - 2*ccc/t;
286  } else {
287  t = -bbb + side*sqrt(discrim);
288  t /= 2;
289  }
290 
291  ret= linedata.a + t*(linedata.b - linedata.a);
292  }
293  if ( !ret.valid() ) return new InvalidImp;
294  // if ( !line->containsPoint( ret, doc ) ) return new InvalidImp;
295  return new PointImp( ret );
296 }
297 
298 /*
299  * This construction is authomatically invoked when the user
300  * intersects two circles with one of the intersections
301  * already present, see above...
302  */
303 
304 static const ArgsParser::spec argsspecCircleCircleOtherIntersection[] =
305 {
306  { CircleImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", true },
307  { CircleImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", true },
308  { PointImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", false }
309 };
310 
311 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( CircleCircleOtherIntersectionType )
312 
313 CircleCircleOtherIntersectionType::CircleCircleOtherIntersectionType()
314  : ArgsParserObjectType( "CircleCircleOtherIntersection",
315  argsspecCircleCircleOtherIntersection, 3 )
316 {
317 }
318 
319 CircleCircleOtherIntersectionType::~CircleCircleOtherIntersectionType()
320 {
321 }
322 
323 const CircleCircleOtherIntersectionType* CircleCircleOtherIntersectionType::instance()
324 {
325  static const CircleCircleOtherIntersectionType t;
326  return &t;
327 }
328 
329 ObjectImp* CircleCircleOtherIntersectionType::calc( const Args& parents, const KigDocument& doc ) const
330 {
331  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
332 
333  Coordinate p = static_cast<const PointImp*>( parents[2] )->coordinate();
334  const CircleImp* circle1 = static_cast<const CircleImp*>( parents[0] );
335  const CircleImp* circle2 = static_cast<const CircleImp*>( parents[1] );
336 
337  if ( !circle1->containsPoint( p, doc ) || !circle2->containsPoint( p, doc ) )
338  {
339  return new InvalidImp;
340  }
341 
342  Coordinate c1 = circle1->center();
343  Coordinate c1c2 = circle2->center() - c1;
344  Coordinate c1p = p - c1;
345  Coordinate w = Coordinate( -c1c2.y, c1c2.x ); /* w is normal to the line through the centers */
346  double wnormsq = w.x*w.x + w.y*w.y;
347  if ( wnormsq < 1e-12 ) return new InvalidImp;
348  double pc1c2dist = ( c1p.x*w.x + c1p.y*w.y )/wnormsq;
349 
350  Coordinate ret = p - 2*pc1c2dist*w;
351  return new PointImp( ret );
352 }
353 
354 /* LineLineIntersection */
355 
356 static const ArgsParser::spec argsspecLineLineIntersection[] =
357 {
358  { AbstractLineImp::stype(), intersectlinestat, "SHOULD NOT BE SEEN", true },
359  { AbstractLineImp::stype(), intersectlinestat, "SHOULD NOT BE SEEN", true }
360 };
361 
362 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( LineLineIntersectionType )
363 
364 LineLineIntersectionType::LineLineIntersectionType()
365  : ArgsParserObjectType( "LineLineIntersection",
366  argsspecLineLineIntersection, 2 )
367 {
368 }
369 
370 LineLineIntersectionType::~LineLineIntersectionType()
371 {
372 }
373 
374 const LineLineIntersectionType* LineLineIntersectionType::instance()
375 {
376  static const LineLineIntersectionType t;
377  return &t;
378 }
379 
380 ObjectImp* LineLineIntersectionType::calc( const Args& parents, const KigDocument& d ) const
381 {
382  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
383 
384  Coordinate p =
385  calcIntersectionPoint(
386  static_cast<const AbstractLineImp*>( parents[0] )->data(),
387  static_cast<const AbstractLineImp*>( parents[1] )->data() );
388  if ( static_cast<const AbstractLineImp*>( parents[0] )->containsPoint( p, d ) &&
389  static_cast<const AbstractLineImp*>( parents[1] )->containsPoint( p, d ) )
390  return new PointImp( p );
391  else return new InvalidImp();
392 }
393 
394 static const ArgsParser::spec argsspecLineCubicIntersection[] =
395 {
396  { CubicImp::stype(), I18N_NOOP( "Intersect with this cubic curve" ),
397  "SHOULD NOT BE SEEN", true },
398  { AbstractLineImp::stype(), intersectlinestat, "SHOULD NOT BE SEEN", true },
399  { IntImp::stype(), "param", "SHOULD NOT BE SEEN", false }
400 };
401 
402 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( LineCubicIntersectionType )
403 
404 LineCubicIntersectionType::LineCubicIntersectionType()
405  : ArgsParserObjectType( "LineCubicIntersection",
406  argsspecLineCubicIntersection, 3 )
407 {
408 }
409 
410 LineCubicIntersectionType::~LineCubicIntersectionType()
411 {
412 }
413 
414 const LineCubicIntersectionType* LineCubicIntersectionType::instance()
415 {
416  static const LineCubicIntersectionType t;
417  return &t;
418 }
419 
420 ObjectImp* LineCubicIntersectionType::calc( const Args& parents, const KigDocument& ) const
421 {
422  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
423 
424  int which = static_cast<const IntImp*>( parents[2] )->data();
425  bool valid = true;
426  const Coordinate c = calcCubicLineIntersect(
427  static_cast<const CubicImp*>( parents[0] )->data(),
428  static_cast<const AbstractLineImp*>( parents[1] )->data(),
429  which, valid );
430  if ( valid ) return new PointImp( c );
431  else return new InvalidImp;
432 }
433 
434 const ObjectImpType* ConicLineIntersectionType::resultId() const
435 {
436  return PointImp::stype();
437 }
438 
439 const ObjectImpType* ConicLineOtherIntersectionType::resultId() const
440 {
441  return PointImp::stype();
442 }
443 
444 const ObjectImpType* CircleCircleOtherIntersectionType::resultId() const
445 {
446  return PointImp::stype();
447 }
448 
449 const ObjectImpType* LineLineIntersectionType::resultId() const
450 {
451  return PointImp::stype();
452 }
453 
454 const ObjectImpType* LineCubicIntersectionType::resultId() const
455 {
456  return PointImp::stype();
457 }
458 
459 const ObjectImpType* CubicLineOtherIntersectionType::resultId() const
460 {
461  return PointImp::stype();
462 }
463 
464 const ObjectImpType* CubicLineTwoIntersectionType::resultId() const
465 {
466  return PointImp::stype();
467 }
468 
469 static const ArgsParser::spec argsspecCircleCircleIntersection[] =
470 {
471  { CircleImp::stype(), I18N_NOOP( "Intersect with this circle" ),
472  "SHOULD NOT BE SEEN", true },
473  { CircleImp::stype(), I18N_NOOP( "Intersect with this circle" ),
474  "SHOULD NOT BE SEEN", true },
475  { IntImp::stype(), "param", "SHOULD NOT BE SEEN", false }
476 };
477 
478 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( CircleCircleIntersectionType )
479 
480 CircleCircleIntersectionType::CircleCircleIntersectionType()
481  : ArgsParserObjectType( "CircleCircleIntersection",
482  argsspecCircleCircleIntersection, 3 )
483 {
484 }
485 
486 CircleCircleIntersectionType::~CircleCircleIntersectionType()
487 {
488 }
489 
490 const CircleCircleIntersectionType* CircleCircleIntersectionType::instance()
491 {
492  static const CircleCircleIntersectionType t;
493  return &t;
494 }
495 
496 ObjectImp* CircleCircleIntersectionType::calc( const Args& parents, const KigDocument& ) const
497 {
498  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
499 
500  int side = static_cast<const IntImp*>( parents[2] )->data();
501  assert( side == 1 || side == -1 );
502  const CircleImp* c1 = static_cast<const CircleImp*>( parents[0] );
503  const CircleImp* c2 = static_cast<const CircleImp*>( parents[1] );
504  const Coordinate o1 = c1->center();
505  const Coordinate o2 = c2->center();
506  const double r1sq = c1->squareRadius();
507  const Coordinate a = calcCircleRadicalStartPoint(
508  o1, o2, r1sq, c2->squareRadius()
509  );
510  const LineData line = LineData (a, Coordinate ( a.x -o2.y + o1.y, a.y + o2.x - o1.x ));
511  Coordinate ret = calcCircleLineIntersect( o1, r1sq, line, side );
512  if ( ret.valid() ) return new PointImp( ret );
513  else return new InvalidImp;
514 }
515 
516 const ObjectImpType* CircleCircleIntersectionType::resultId() const
517 {
518  return PointImp::stype();
519 }
520 
521 static const ArgsParser::spec argsspecArcLineIntersection[] =
522 {
523  { ArcImp::stype(), I18N_NOOP( "Intersect with this arc" ),
524  "SHOULD NOT BE SEEN", true },
525  { AbstractLineImp::stype(), intersectlinestat, "SHOULD NOT BE SEEN", true },
526  { IntImp::stype(), "param", "SHOULD NOT BE SEEN", false }
527 };
528 
529 KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( ArcLineIntersectionType )
530 
531 ArcLineIntersectionType::ArcLineIntersectionType()
532  : ArgsParserObjectType( "ArcLineIntersection",
533  argsspecArcLineIntersection, 3 )
534 {
535 }
536 
537 ArcLineIntersectionType::~ArcLineIntersectionType()
538 {
539 }
540 
541 const ArcLineIntersectionType* ArcLineIntersectionType::instance()
542 {
543  static const ArcLineIntersectionType t;
544  return &t;
545 }
546 
547 ObjectImp* ArcLineIntersectionType::calc( const Args& parents, const KigDocument& ) const
548 {
549  if ( ! margsparser.checkArgs( parents ) ) return new InvalidImp;
550 
551  int side = static_cast<const IntImp*>( parents[2] )->data();
552  assert( side == 1 || side == -1 );
553  const LineData line = static_cast<const AbstractLineImp*>( parents[1] )->data();
554 
555  const ArcImp* c = static_cast<const ArcImp*>( parents[0] );
556  const double r = c->radius();
557  Coordinate ret = calcArcLineIntersect( c->center(), r*r, c->startAngle(),
558  c->angle(), line, side );
559  if ( ret.valid() ) return new PointImp( ret );
560  else return new InvalidImp;
561 }
562 
563 const ObjectImpType* ArcLineIntersectionType::resultId() const
564 {
565  return PointImp::stype();
566 }
calcCubicLineRestriction
void calcCubicLineRestriction(CubicCartesianData data, Coordinate p, Coordinate v, double &a, double &b, double &c, double &d)
Definition: cubic-common.cc:395
argsspecConicLineOtherIntersection
static const ArgsParser::spec argsspecConicLineOtherIntersection[]
Definition: intersection_types.cc:99
argsspecLineCubicIntersection
static const ArgsParser::spec argsspecLineCubicIntersection[]
Definition: intersection_types.cc:394
ArcLineIntersectionType::instance
static const ArcLineIntersectionType * instance()
Definition: intersection_types.cc:541
CubicImp
An ObjectImp representing a cubic.
Definition: cubic_imp.h:29
ObjectImpType
Instances of this class represent a certain ObjectImp type.
Definition: object_imp.h:95
AbstractLineImp::data
LineData data() const
Get the LineData for this AbstractLineImp.
Definition: line_imp.cc:359
CircleCircleIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:516
KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE
KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE(SegmentAxisType)
point_imp.h
ArgsParserObjectType
This is a convenience subclass of ObjectType that a type should inherit from if its parents can be sp...
Definition: object_type.h:113
ObjectType::inherits
virtual bool inherits(int type) const
Definition: object_type.cc:64
AbstractLineImp
An ObjectImp class that is the base of the line-like ObjectImp's: SegmentImp, LineImp and RayImp...
Definition: line_imp.h:31
LineData
Simple class representing a line.
Definition: misc/common.h:49
CircleCircleOtherIntersectionType::instance
static const CircleCircleOtherIntersectionType * instance()
Definition: intersection_types.cc:323
ConicLineIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:60
LineData::b
Coordinate b
Another point on the line.
Definition: misc/common.h:68
CircleCircleIntersectionType
Definition: intersection_types.h:126
CircleImp
An ObjectImp representing a circle.
Definition: circle_imp.h:27
CircleCircleOtherIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:444
CubicLineOtherIntersectionType::instance
static const CubicLineOtherIntersectionType * instance()
Definition: intersection_types.cc:173
argsspecCubicLineOtherIntersection
static const ArgsParser::spec argsspecCubicLineOtherIntersection[]
Definition: intersection_types.cc:153
CircleImp::center
const Coordinate center() const
Return the center of this circle.
Definition: circle_imp.cc:210
ConicLineIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:434
CircleCircleIntersectionType::instance
static const CircleCircleIntersectionType * instance()
Definition: intersection_types.cc:490
argsspecLineLineIntersection
static const ArgsParser::spec argsspecLineLineIntersection[]
Definition: intersection_types.cc:356
argsspecConicLineIntersection
static const ArgsParser::spec argsspecConicLineIntersection[]
Definition: intersection_types.cc:34
LineCubicIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:420
CircleCircleOtherIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:329
circle_imp.h
IntImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the IntImp type.
Definition: bogus_imp.cc:278
ArcLineIntersectionType
arc line intersection.
Definition: intersection_types.h:140
CubicLineOtherIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:459
IntImp
This ObjectImp is a BogusImp containing only an int value.
Definition: bogus_imp.h:128
ArcImp::radius
double radius() const
Return the radius of this arc.
Definition: other_imp.cc:537
CubicLineTwoIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:247
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
ConicImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: conic_imp.cc:402
argsspecCubicLineTwoIntersection
static const ArgsParser::spec argsspecCubicLineTwoIntersection[]
Definition: intersection_types.cc:221
ConicLineOtherIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:439
LineCubicIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:454
ArgsParserObjectType::margsparser
const ArgsParser margsparser
Definition: object_type.h:117
ConicLineOtherIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:124
calcConicLineIntersect
const Coordinate calcConicLineIntersect(const ConicCartesianData &c, const LineData &l, double knownparam, int which)
This function calculates the intersection of a given line ( l ) and a given conic ( c )...
Definition: conic-common.cpp:367
LineLineIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:449
LineLineIntersectionType::instance
static const LineLineIntersectionType * instance()
Definition: intersection_types.cc:374
calcCircleRadicalStartPoint
Coordinate calcCircleRadicalStartPoint(const Coordinate &ca, const Coordinate &cb, double sqra, double sqrb)
Definition: common.cpp:335
ArcImp::angle
double angle() const
Return the dimension in radians of this arc.
Definition: other_imp.cc:547
bogus_imp.h
PointImp
An ObjectImp representing a point.
Definition: point_imp.h:27
Args
std::vector< const ObjectImp * > Args
Definition: objects/common.h:47
argsspecCircleCircleOtherIntersection
static const ArgsParser::spec argsspecCircleCircleOtherIntersection[]
Definition: intersection_types.cc:304
calcArcLineIntersect
const Coordinate calcArcLineIntersect(const Coordinate &c, const double sqr, const double sa, const double angle, const LineData &l, int side)
this calcs the intersection points of the arc with center c, radius sqrt( r ), start angle sa and ang...
Definition: common.cpp:285
CubicLineTwoIntersectionType
one of the two cubic line intersection points, in case we already know one of the three intersections...
Definition: intersection_types.h:79
CubicLineOtherIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:179
LineData::a
Coordinate a
One point on the line.
Definition: misc/common.h:64
ArgsParser::checkArgs
bool checkArgs(const std::vector< ObjectCalcer * > &os) const
Definition: argsparser.cpp:222
intersectlinestat
static const char intersectlinestat[]
Definition: intersection_types.cc:32
ConicLineIntersectionType
conic line intersection.
Definition: intersection_types.h:32
LineCubicIntersectionType::instance
static const LineCubicIntersectionType * instance()
Definition: intersection_types.cc:414
CubicCartesianData
This class represents an equation of a cubic in the form (in homogeneous coordinates, ), .
Definition: cubic-common.h:31
ArgsParser::spec
Definition: argsparser.h:113
ArcImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the ArcImp type.
Definition: other_imp.cc:629
ConicImp
An ObjectImp representing a conic.
Definition: conic_imp.h:39
calcIntersectionPoint
Coordinate calcIntersectionPoint(const LineData &l1, const LineData &l2)
this calcs the point where the lines l and m intersect...
Definition: common.cpp:57
ArcImp::center
const Coordinate center() const
Return the center of this arc.
Definition: other_imp.cc:532
CircleImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the CircleImp type.
Definition: circle_imp.cc:342
CubicLineTwoIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:464
CircleCircleOtherIntersectionType
circle circle 'other' intersection.
Definition: intersection_types.h:93
ArcImp::startAngle
double startAngle() const
Return the start angle in radians of this arc.
Definition: other_imp.cc:542
intersection_types.h
argsspecCircleCircleIntersection
static const ArgsParser::spec argsspecCircleCircleIntersection[]
Definition: intersection_types.cc:469
ArcLineIntersectionType::resultId
const ObjectImpType * resultId() const
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
Definition: intersection_types.cc:563
argsspecArcLineIntersection
static const ArgsParser::spec argsspecArcLineIntersection[]
Definition: intersection_types.cc:521
PointImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing PointImp's.
Definition: point_imp.cc:159
ConicLineOtherIntersectionType
conic line 'other' intersection.
Definition: intersection_types.h:47
CubicImp::data
const CubicCartesianData data() const
Return the cartesian representation of this cubic.
Definition: cubic_imp.cc:331
line_imp.h
LineLineIntersectionType
Definition: intersection_types.h:104
ConicImp::cartesianData
virtual const ConicCartesianData cartesianData() const
Return the cartesian representation of this conic.
Definition: conic_imp.cc:285
LineLineIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:380
CurveImp::containsPoint
virtual bool containsPoint(const Coordinate &p, const KigDocument &) const =0
Return whether this Curve contains the given point.
ConicImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the ConicImp type.
Definition: conic_imp.cc:380
cubic_imp.h
KigDocument
KigDocument is the class holding the real data in a Kig document.
Definition: kig_document.h:36
calcCubicLineIntersect
const Coordinate calcCubicLineIntersect(const CubicCartesianData &cu, const LineData &l, int root, bool &valid)
Definition: cubic-common.cc:375
AbstractLineImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the AbstractLineImp type.
Definition: line_imp.cc:520
ConicLineIntersectionType::instance
static const ConicLineIntersectionType * instance()
Definition: intersection_types.cc:54
CubicLineTwoIntersectionType::instance
static const CubicLineTwoIntersectionType * instance()
Definition: intersection_types.cc:241
ArcImp
An ObjectImp representing an arc.
Definition: other_imp.h:169
Coordinate::x
double x
X Component.
Definition: coordinate.h:126
CubicImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: cubic_imp.cc:369
ArcLineIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:547
Coordinate::y
double y
Y Component.
Definition: coordinate.h:129
ObjectImp
The ObjectImp class represents the behaviour of an object after it is calculated. ...
Definition: object_imp.h:226
calcCircleLineIntersect
const Coordinate calcCircleLineIntersect(const Coordinate &c, const double sqr, const LineData &l, int side)
this calcs the intersection points of the circle with center c and radius sqrt( r )...
Definition: common.cpp:262
CircleImp::squareRadius
double squareRadius() const
Return the square radius of this circle.
Definition: circle_imp.cc:225
LineCubicIntersectionType
Definition: intersection_types.h:115
CubicImp::stype
static const ObjectImpType * stype()
Definition: cubic_imp.cc:352
CubicLineOtherIntersectionType
Francesca Gatti (frency.gatti@gmail.com), january 2008:
Definition: intersection_types.h:64
conic_imp.h
ConicLineOtherIntersectionType::instance
static const ConicLineOtherIntersectionType * instance()
Definition: intersection_types.cc:118
Coordinate::valid
bool valid() const
Return whether this is a valid Coordinate.
Definition: coordinate.cpp:176
InvalidImp
This ObjectImp represents an invalid object.
Definition: bogus_imp.h:61
other_imp.h
CircleCircleIntersectionType::calc
ObjectImp * calc(const Args &parents, const KigDocument &) const
Definition: intersection_types.cc:496
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:05 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
  • 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