1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes 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.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2009 Henrik Tidefelt
21 #include "Shapes_Lang_decls.h"
22 #include "Shapes_Ast_decls.h"
23 #include "Shapes_Computation_decls.h"
24 #include "Shapes_Kernel_decls.h"
28 #include "pdfstructure.h"
29 #include "shapesvalue.h"
30 #include "environment.h"
31 #include "charptrless.h"
32 #include "functiontypes.h"
33 #include "elementarycoords.h"
34 #include "concretecolors.h"
47 class FacetNormalGray
: public NoOperatorOverloadValue
49 Concrete::Coords3D position_
;
50 RefCountPtr
< const Lang::SpecularReflection
> reflections_
;
51 Concrete::UnitFloatTriple reflectionUnitNormal_
;
52 Concrete::Gray lightMultiply_
;
53 RefCountPtr
< const Lang::SpecularReflection
> autoScattering_
;
54 Concrete::Gray autoIntensity_
;
56 FacetNormalGray( const Concrete::Coords3D
& position
,
57 const RefCountPtr
< const Lang::SpecularReflection
> & reflections
,
58 const Concrete::UnitFloatTriple
& reflectionUnitNormal
,
59 const Concrete::Gray lightMultiply
,
60 const RefCountPtr
< const Lang::SpecularReflection
> & autoScattering
,
61 const Concrete::Gray autoIntensity
);
62 virtual ~FacetNormalGray( );
63 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
65 Concrete::Gray
compute( const Concrete::Coords3D
& point
, const Concrete::UnitFloatTriple normal
, const Lang::Transform3D
& tf
, const Concrete::Length eyez
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
66 Concrete::Gray
compute( const Concrete::Coords3D
& point
, const Lang::Transform3D
& tf
, const Concrete::Length eyez
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
67 const Concrete::Coords3D
& position( ) const { return position_
; }
68 const Concrete::UnitFloatTriple
& normal( ) const { return reflectionUnitNormal_
; }
69 Concrete::Gray
getDebugColor( ) const;
70 RefCountPtr
< const Lang::FacetNormalGray
> transformed( const Lang::Transform3D
& tf
) const;
74 class FacetNormalRGB
: public NoOperatorOverloadValue
76 Concrete::Coords3D position_
;
77 RefCountPtr
< const Lang::SpecularReflection
> reflections_
;
78 Concrete::UnitFloatTriple reflectionUnitNormal_
;
79 Concrete::RGB lightMultiply_
;
80 RefCountPtr
< const Lang::SpecularReflection
> autoScattering_
;
81 Concrete::RGB autoIntensity_
;
83 FacetNormalRGB( const Concrete::Coords3D
& position
,
84 const RefCountPtr
< const Lang::SpecularReflection
> & reflections
,
85 const Concrete::UnitFloatTriple
& reflectionUnitNormal
,
86 const Concrete::RGB
& lightMultiply
,
87 const RefCountPtr
< const Lang::SpecularReflection
> & autoScattering
,
88 const Concrete::RGB
& autoIntensity
);
89 virtual ~FacetNormalRGB( );
90 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
92 Concrete::RGB
compute( const Concrete::Coords3D
& point
, const Concrete::UnitFloatTriple normal
, const Lang::Transform3D
& tf
, const Concrete::Length eyez
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
93 Concrete::RGB
compute( const Concrete::Coords3D
& point
, const Lang::Transform3D
& tf
, const Concrete::Length eyez
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
94 const Concrete::Coords3D
& position( ) const { return position_
; }
95 const Concrete::UnitFloatTriple
& normal( ) const { return reflectionUnitNormal_
; }
96 Concrete::RGB
getDebugColor( ) const;
97 RefCountPtr
< const Lang::FacetNormalRGB
> transformed( const Lang::Transform3D
& tf
) const;
103 namespace Computation
110 Concrete::UnitFloatTriple normal_
;
112 // The first group of members are used to compute the depth
117 Physical
< -1, 0 > eyezInv_
;
119 // To break ties, one shall consult this member:
120 Concrete::Length tiebreaker_
;
122 // The next group of members are used to find plane intersections
123 Concrete::Length eyez_
;
125 ZMap( const Concrete::UnitFloatTriple
& normal
,
127 Concrete::Length tiebreaker
,
128 Concrete::Length eyez
);
130 Concrete::Length
operator () ( const Concrete::Coords2D
& p
) const;
132 void writeToMatrices( double a
[3], Concrete::Length
* b
) const;
133 Concrete::Length
eyez( ) const { return eyez_
; }
134 const Concrete::UnitFloatTriple
& getNormal( ) const { return normal_
; }
135 Concrete::Length
getM( ) const { return m_
; }
136 Concrete::Length
getTiebreaker( ) const { return tiebreaker_
; }
139 const Computation::PaintedPolygon3D
* painter_
;
140 std::vector
< Concrete::Coords2D
> points_
;
141 RefCountPtr
< const ZMap
> zMap_
;
143 std::list
< RefCountPtr
< const Lang::LightSource
> > shadowLights_
;
145 ZBufTriangle( const Computation::PaintedPolygon3D
* painter
, const RefCountPtr
< const Computation::ZBufTriangle::ZMap
> & zMap
, const Concrete::Coords2D
& p1
, const Concrete::Coords2D
& p2
, const Concrete::Coords2D
& p3
);
146 Concrete::Length
zAt( const Concrete::Coords2D
& p
) const;
147 bool isOnTopOfAt( const Computation::ZBufTriangle
& other
, const Concrete::Coords2D
& p
) const;
148 bool overlaps( const ZBufTriangle
& other
) const;
149 bool overlaps( const ZBufTriangle
& other
, Concrete::Coords2D
* commonPoint
, Concrete::Length tol
) const; // tol shall be positive, and gives the smallest acceptable distance from commonPoint to the intersection boundary.
150 bool intersection( const Computation::ZBufTriangle
& other
, Computation::SplicingLine
* line
) const;
151 bool overlapsAlong( const ZBufTriangle
& other
, const Computation::SplicingLine
& line
, Concrete::Length tol
) const; // tol shall be positive, and gives the smallest acceptable distance from commonPoint to the intersection boundary.
152 bool contains( const Concrete::Coords2D
& p
) const;
153 bool contains( const Concrete::Coords2D
& p
, Concrete::Length tol
) const;
154 static void splice( const ZBufTriangle
& tOld
, const ZBufTriangle
& tNew
, std::list
< Computation::ZBufTriangle
> * oldDisjointTriangles
, std::list
< Computation::ZBufTriangle
> * oldOccludedTriangles
, std::list
< Computation::ZBufTriangle
> * newDisjointTriangles
, std::list
< Computation::ZBufTriangle
> * newOccludedTriangles
, std::list
< Computation::ZBufTriangle
> * triangleQueue
);
155 std::list
< Computation::ZBufTriangle
>::iterator
spliceAlong( const Computation::SplicingLine
& line
, std::list
< Computation::ZBufTriangle
> * dst
) const;
156 RefCountPtr
< const Lang::ElementaryPath2D
> toPath( ) const;
157 RefCountPtr
< const Lang::Drawable2D
> debugFrame( ) const;
158 void pushLines( std::vector
< Computation::SplicingLine
> * dst
) const;
159 void pushIntersection( std::vector
< Computation::SplicingLine
> * dst
, const Computation::ZBufTriangle
& other
) const;
161 void addTriangleConstraints( Concrete::Coords2D llCorner
, double * a
, double * b
) const; // To be used by overlaps.
163 Concrete::Area
area( ) const;
166 static bool oneWayOverlap( const std::vector
< Concrete::Coords2D
> & poly1
, const std::vector
< Concrete::Coords2D
> & poly2
);
167 void pushIfUnique( std::vector
< Computation::SplicingLine
> * dst
, const Concrete::Coords3D p0
, const Concrete::Coords3D p1
, bool isTriangleSide
= true ) const;
168 bool intersectionLinePoints( const Computation::ZBufTriangle
& other
, Concrete::Coords3D
* p0
, Concrete::Coords3D
* p1
) const;
169 friend std::ostream
& operator << ( std::ostream
& os
, const Computation::ZBufTriangle
& self
);
172 std::ostream
& operator << ( std::ostream
& os
, const Computation::ZBufTriangle
& self
);
179 Concrete::Coords3D p0_
;
180 Concrete::UnitFloatTriple d_
;
182 // The first group of members are used to compute the depth
186 // Physical< -1, 0 > eyezInv_;
188 // The next group of members are used to find plane intersections
189 Concrete::Length eyez_
;
191 ZMap( Concrete::Coords3D p0
, const Concrete::UnitFloatTriple
& d
,
192 Concrete::Length eyez
);
194 // It is assumed that this funciton is only called with points that actually are on the line.
195 Concrete::Length
operator () ( const Concrete::Coords2D
& p
) const;
196 Concrete::Coords3D
intersection( const Computation::ZBufTriangle::ZMap
& plane
) const;
198 Concrete::Length
eyez( ) const { return eyez_
; }
201 const Computation::StrokedLine3D
* painter_
;
202 RefCountPtr
< const Bezier::PolyCoeffs
< Concrete::Coords2D
> > bezierView_
;
204 Concrete::Coords2D p0_
;
205 Concrete::Coords2D p1_
;
206 Concrete::Coords2D d_
; // this is just p1_ - p0_
207 RefCountPtr
< const ZMap
> zMap_
;
209 ZBufLine( const Computation::StrokedLine3D
* painter
, const RefCountPtr
< const Computation::ZBufLine::ZMap
> & zMap
, const RefCountPtr
< const Bezier::PolyCoeffs
< Concrete::Coords2D
> > & bezierView
, const Concrete::Coords2D
& p0
, const Concrete::Coords2D
& p1
);
210 Concrete::Length
zAt( const Concrete::Coords2D
& p
) const;
211 bool overlaps( const ZBufTriangle
& other
) const;
212 bool overlaps( const ZBufLine
& other
) const;
213 void splice( const ZBufTriangle
& triangle
, std::list
< const Computation::ZBufLine
* > * myLines
) const;
214 static void splice( const ZBufLine
* line1
, const ZBufLine
* line2
, std::list
< const Computation::ZBufLine
* > * line1Container
, std::list
< const Computation::ZBufLine
* > * line2Container
);
215 RefCountPtr
< const Lang::PaintedPath2D
> stroke2D( ) const;
218 double intersectionTime( Concrete::Coords2D p0
, Concrete::Coords2D p1
) const;
221 class FacetLatticeVertex
224 Concrete::Coords3D p3D_
;
225 Concrete::Coords2D p2D_
;
228 FacetLatticeVertex( const Concrete::Coords3D
& p3D
, const Concrete::Length eyez
, const size_t i
);
229 ~FacetLatticeVertex( ){ }
231 Concrete::Length
distanceTo2D( const Computation::FacetLatticeVertex
& other
) const
233 return p2D_
.distanceTo( other
.p2D_
);
237 class FacetLatticeEdge
239 mutable const FacetLatticeEdge
* child1_
;
240 mutable const FacetLatticeEdge
* child2_
;
242 const Computation::FacetLatticeVertex
* p0_
;
243 const Computation::FacetLatticeVertex
* p1_
;
245 FacetLatticeEdge( const Computation::FacetLatticeVertex
* p0
, const Computation::FacetLatticeVertex
* p1
)
246 : child1_( 0 ), child2_( 0 ), p0_( p0
), p1_( p1
)
249 void split( const Concrete::Length eyez
,
250 PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeEdge
* > > * edgeMem
,
251 PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeVertex
* > > * vertexMem
,
252 const Computation::FacetLatticeEdge
** child1
, const Computation::FacetLatticeEdge
** child2
) const;
254 const FacetLatticeVertex
* getOther( const FacetLatticeEdge
* e
) const;
255 bool sharePoint( const FacetLatticeEdge
* e
) const;
256 Concrete::Length
length2D( ) const
258 return p0_
->p2D_
.distanceTo( p1_
->p2D_
);
261 const FacetLatticeVertex
* midpoint( ) const
267 class FacetLatticeTriangle
270 const Computation::FacetLatticeEdge
* e0_
;
271 const Computation::FacetLatticeEdge
* e1_
;
272 const Computation::FacetLatticeEdge
* e2_
;
274 const Computation::FacetLatticeVertex
* v0_
;
275 const Computation::FacetLatticeVertex
* v1_
;
276 const Computation::FacetLatticeVertex
* v2_
;
279 FacetLatticeTriangle( const Computation::FacetLatticeEdge
* e0
, const Computation::FacetLatticeEdge
* e1
, const Computation::FacetLatticeEdge
* e2
)
280 : e0_( e0
), e1_( e1
), e2_( e2
),
281 v0_( e0_
->p0_
), v1_( e0_
->p1_
), v2_( e1_
->getOther( e0_
) )
283 ~FacetLatticeTriangle( )
286 const FacetLatticeEdge
* getOther( const Computation::FacetLatticeEdge
* ea
, const Computation::FacetLatticeEdge
* eb
) const;
287 bool fitsResolution( const Concrete::Length resolution
, const Concrete::Length eyez
,
288 PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeEdge
* > > * edgeMem
,
289 PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeVertex
* > > * vertexMem
,
290 const Computation::FacetLatticeTriangle
** child1
, const Computation::FacetLatticeTriangle
** child2
) const;
291 RefCountPtr
< const Lang::Drawable2D
> paint( const RefCountPtr
< const Computation::FacetInterpolatorGray
> & interpolator
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Length eyez
) const;
292 RefCountPtr
< const Lang::Drawable2D
> paint( const RefCountPtr
< const Computation::FacetInterpolatorRGB
> & interpolator
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Length eyez
) const;
293 void getVertexes( const Computation::FacetLatticeVertex
** va
, const Computation::FacetLatticeVertex
** vb
, const Computation::FacetLatticeVertex
** vc
) const;
294 unsigned char extendLattice( const Computation::FacetLatticeVertex
** va
, const Computation::FacetLatticeVertex
** vb
, const Computation::FacetLatticeVertex
** vc
) const;
295 void display2D( std::ostream
& os
) const;
296 void display3D( std::ostream
& os
) const;
302 Concrete::Coords3D p0_
;
303 Concrete::Coords3D p1_
;
304 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
306 StrokedLine3D( const Concrete::Coords3D
& p0
, const Concrete::Coords3D
& p1
, const RefCountPtr
< const Kernel::GraphicsState
> metaState
);
307 virtual ~StrokedLine3D( );
308 virtual void push_zBufLine( const Lang::Transform3D
& tf
, const Concrete::Length eyez
, std::list
< const Computation::ZBufLine
* > * lineQueue
) const;
309 const RefCountPtr
< const Kernel::GraphicsState
> & getMetaState( ) const { return metaState_
; }
312 class StrokedSplineSegment3D
: public StrokedLine3D
314 Concrete::Coords3D p0front_
;
315 Concrete::Coords3D p1rear_
;
317 StrokedSplineSegment3D( const Concrete::Coords3D
& p0
, const Concrete::Coords3D
& p0front
, const Concrete::Coords3D
& p1rear
, const Concrete::Coords3D
& p1
, const RefCountPtr
< const Kernel::GraphicsState
> metaState
);
318 ~StrokedSplineSegment3D( );
319 virtual void push_zBufLine( const Lang::Transform3D
& tf
, const Concrete::Length eyez
, std::list
< const Computation::ZBufLine
* > * lineQueue
) const;
322 class PaintedPolygon3D
325 std::list
< Concrete::Coords3D
> points_
;
326 // The following two members define the plane in which all points are required to be
327 bool singleSided_
; // If true, normal_ is the outward normal of the surface of a solid object. I false, this area has two opposite outward normals.
328 Concrete::UnitFloatTriple normal_
;
330 Concrete::Length tiebreaker_
;
332 PaintedPolygon3D( bool singleSided
, const Concrete::UnitFloatTriple
& normal
, Concrete::Length m
, Concrete::Length tiebreaker
);
333 virtual ~PaintedPolygon3D( );
334 void pushPoint( const Concrete::Coords3D
& p
);
335 void push_zBufTriangles( const Lang::Transform3D
& tf
, const Concrete::Length eyez
, std::list
< Computation::ZBufTriangle
> * triangleQueue
, bool respectSingleSided
= false ) const;
337 virtual RefCountPtr
< const Lang::PaintedPolygon2D
> polygon_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const = 0;
338 virtual RefCountPtr
< const Lang::Color
> getColor( ) const = 0;
340 void makeLattice( PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
,
341 PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeEdge
* > > * edgeMem
,
342 PtrOwner_back_Access
< std::list
< const FacetLatticeVertex
* > > * vertexMem
,
343 const Concrete::Length viewResolution
,
344 const Concrete::Length eyez
, const Lang::Transform3D
& tf
) const;
346 virtual void gcMark( Kernel::GCMarkedSet
& marked
) = 0;
348 Concrete::Coords3D
computeMean( ) const;
350 PaintedPolygon3D( const Computation::PaintedPolygon3D
& orig
);
353 class FacetInterpolatorGray
356 FacetInterpolatorGray( ){ };
357 virtual ~FacetInterpolatorGray( );
358 virtual RefCountPtr
< const Lang::Gray
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const = 0;
359 virtual RefCountPtr
< const Lang::Gray
> getDebugColor( ) const = 0;
360 virtual RefCountPtr
< const Computation::FacetInterpolatorGray
> transformed( const Lang::Transform3D
& tf
) const = 0;
361 virtual void gcMark( Kernel::GCMarkedSet
& marked
) = 0;
364 class FacetInterpolatorGray1
: public FacetInterpolatorGray
366 RefCountPtr
< const Lang::FacetNormalGray
> n1_
;
368 FacetInterpolatorGray1( const RefCountPtr
< const Lang::FacetNormalGray
> & n1
)
371 virtual ~FacetInterpolatorGray1( );
372 virtual RefCountPtr
< const Lang::Gray
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const;
373 virtual RefCountPtr
< const Lang::Gray
> getDebugColor( ) const;
374 virtual RefCountPtr
< const Computation::FacetInterpolatorGray
> transformed( const Lang::Transform3D
& tf
) const;
375 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
378 class FacetInterpolatorGray2
: public FacetInterpolatorGray
380 RefCountPtr
< const Lang::FacetNormalGray
> n1_
;
381 RefCountPtr
< const Lang::FacetNormalGray
> n2_
;
383 // We define members such that the weight of n2_ at point p is
384 // ( < t_, p > - m_ ) / d_
385 // that is, at least as long as this number is in the range [ 0, 1 ].
387 Concrete::UnitFloatTriple t_
;
390 // We also define members that describe how the normal at n1_ is rotated to obtain the normal at n2_
392 Concrete::UnitFloatTriple rotationDirection_
;
394 FacetInterpolatorGray2( const RefCountPtr
< const Lang::FacetNormalGray
> & n1
,
395 const RefCountPtr
< const Lang::FacetNormalGray
> & n2
);
396 virtual ~FacetInterpolatorGray2( );
397 virtual RefCountPtr
< const Lang::Gray
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const;
398 virtual RefCountPtr
< const Lang::Gray
> getDebugColor( ) const;
399 virtual RefCountPtr
< const Computation::FacetInterpolatorGray
> transformed( const Lang::Transform3D
& tf
) const;
400 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
403 class FacetInterpolatorGray3
: public FacetInterpolatorGray
405 RefCountPtr
< const Lang::FacetNormalGray
> n1_
;
406 RefCountPtr
< const Lang::FacetNormalGray
> n2_
;
407 RefCountPtr
< const Lang::FacetNormalGray
> n3_
;
409 // The interpolation here is much less sophisticated compared to the interpolation of two normals.
410 // We compute positive, unnormalized weights wuch that each weight is one at the point it belongs to, and vanishes
411 // at the line through the other points. Then we normalize. This should be subject to change in later versions!
412 Concrete::Coords3D p1_
;
413 Concrete::Coords3D p2_
;
414 Concrete::Coords3D p3_
;
415 Concrete::UnitFloatTriple d1_
;
416 Concrete::UnitFloatTriple d2_
;
417 Concrete::UnitFloatTriple d3_
;
418 Concrete::Length l1_
;
419 Concrete::Length l2_
;
420 Concrete::Length l3_
;
422 FacetInterpolatorGray3( const RefCountPtr
< const Lang::FacetNormalGray
> & n1
,
423 const RefCountPtr
< const Lang::FacetNormalGray
> & n2
,
424 const RefCountPtr
< const Lang::FacetNormalGray
> & n3
);
425 virtual ~FacetInterpolatorGray3( );
426 virtual RefCountPtr
< const Lang::Gray
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const;
427 virtual RefCountPtr
< const Lang::Gray
> getDebugColor( ) const;
428 virtual RefCountPtr
< const Computation::FacetInterpolatorGray
> transformed( const Lang::Transform3D
& tf
) const;
429 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
432 class FacetInterpolatorRGB
435 FacetInterpolatorRGB( ){ };
436 virtual ~FacetInterpolatorRGB( );
437 virtual RefCountPtr
< const Lang::RGB
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const = 0;
438 virtual RefCountPtr
< const Lang::RGB
> getDebugColor( ) const = 0;
439 virtual RefCountPtr
< const Computation::FacetInterpolatorRGB
> transformed( const Lang::Transform3D
& tf
) const = 0;
440 virtual void gcMark( Kernel::GCMarkedSet
& marked
) = 0;
443 class FacetInterpolatorRGB1
: public FacetInterpolatorRGB
445 RefCountPtr
< const Lang::FacetNormalRGB
> n1_
;
447 FacetInterpolatorRGB1( const RefCountPtr
< const Lang::FacetNormalRGB
> & n1
)
450 virtual ~FacetInterpolatorRGB1( );
451 virtual RefCountPtr
< const Lang::RGB
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const;
452 virtual RefCountPtr
< const Lang::RGB
> getDebugColor( ) const;
453 virtual RefCountPtr
< const Computation::FacetInterpolatorRGB
> transformed( const Lang::Transform3D
& tf
) const;
454 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
457 class FacetInterpolatorRGB2
: public FacetInterpolatorRGB
459 RefCountPtr
< const Lang::FacetNormalRGB
> n1_
;
460 RefCountPtr
< const Lang::FacetNormalRGB
> n2_
;
462 // We define members such that the weight of n2_ at point p is
463 // ( < t_, p > - m_ ) / d_
464 // that is, at least as long as this number is in the range [ 0, 1 ].
466 Concrete::UnitFloatTriple t_
;
469 // We also define members that describe how the normal at n1_ is rotated to obtain the normal at n2_
471 Concrete::UnitFloatTriple rotationDirection_
;
473 FacetInterpolatorRGB2( const RefCountPtr
< const Lang::FacetNormalRGB
> & n1
,
474 const RefCountPtr
< const Lang::FacetNormalRGB
> & n2
);
475 virtual ~FacetInterpolatorRGB2( );
476 virtual RefCountPtr
< const Lang::RGB
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const;
477 virtual RefCountPtr
< const Lang::RGB
> getDebugColor( ) const;
478 virtual RefCountPtr
< const Computation::FacetInterpolatorRGB
> transformed( const Lang::Transform3D
& tf
) const;
479 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
482 class FacetInterpolatorRGB3
: public FacetInterpolatorRGB
484 RefCountPtr
< const Lang::FacetNormalRGB
> n1_
;
485 RefCountPtr
< const Lang::FacetNormalRGB
> n2_
;
486 RefCountPtr
< const Lang::FacetNormalRGB
> n3_
;
488 // The interpolation here is much less sophisticated compared to the interpolation of two normals.
489 // We compute positive, unnormalized weights wuch that each weight is one at the point it belongs to, and vanishes
490 // at the line through the other points. Then we normalize. This should be subject to change in later versions!
491 Concrete::Coords3D p1_
;
492 Concrete::Coords3D p2_
;
493 Concrete::Coords3D p3_
;
494 Concrete::UnitFloatTriple d1_
;
495 Concrete::UnitFloatTriple d2_
;
496 Concrete::UnitFloatTriple d3_
;
497 Concrete::Length l1_
;
498 Concrete::Length l2_
;
499 Concrete::Length l3_
;
501 FacetInterpolatorRGB3( const RefCountPtr
< const Lang::FacetNormalRGB
> & n1
,
502 const RefCountPtr
< const Lang::FacetNormalRGB
> & n2
,
503 const RefCountPtr
< const Lang::FacetNormalRGB
> & n3
);
504 virtual ~FacetInterpolatorRGB3( );
505 virtual RefCountPtr
< const Lang::RGB
> compute( const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, const Concrete::Coords3D
& point
, const Concrete::Length eyez
) const;
506 virtual RefCountPtr
< const Lang::RGB
> getDebugColor( ) const;
507 virtual RefCountPtr
< const Computation::FacetInterpolatorRGB
> transformed( const Lang::Transform3D
& tf
) const;
508 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
511 class FilledPolygon3D
: public PaintedPolygon3D
513 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
515 FilledPolygon3D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
,
516 const Concrete::UnitFloatTriple
& normal
, Concrete::Length m
,
517 Concrete::Length tiebreaker
);
518 virtual ~FilledPolygon3D( );
519 virtual RefCountPtr
< const Lang::PaintedPolygon2D
> polygon_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
520 virtual RefCountPtr
< const Lang::Color
> getColor( ) const; // shall only be used for debugging!
521 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
524 class NullPolygon3D
: public PaintedPolygon3D
528 virtual ~NullPolygon3D( );
529 virtual RefCountPtr
< const Lang::PaintedPolygon2D
> polygon_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
530 virtual RefCountPtr
< const Lang::Color
> getColor( ) const; // shall only be used for debugging!
531 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
534 class SingleSidedPolygon3DGray
: public PaintedPolygon3D
536 RefCountPtr
< const Computation::FacetInterpolatorGray
> interpolator_
;
537 Concrete::Length viewResolution_
;
538 Computation::FacetShadeOrder shadeOrder_
; // legal values: { 0, 1, 2 }
540 SingleSidedPolygon3DGray( const RefCountPtr
< const Computation::FacetInterpolatorGray
> & interpolator
,
541 bool singleSided
, // Confusingly, this type is sometimes used also for double-sided polygons.
542 const Concrete::UnitFloatTriple
& polygonUnitNormal
,
544 Concrete::Length tiebreaker
,
545 Concrete::Length viewResolution
,
546 Computation::FacetShadeOrder shadeOrder
);
547 virtual ~SingleSidedPolygon3DGray( );
548 virtual RefCountPtr
< const Lang::PaintedPolygon2D
> polygon_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
549 virtual RefCountPtr
< const Lang::Color
> getColor( ) const; // shall only be used for debugging!
550 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
553 RefCountPtr
< const Lang::PaintedPolygon2D
> simple_polygon_to2D( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
554 RefCountPtr
< const Lang::PaintedPolygon2D
> render0( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
) const;
555 RefCountPtr
< const Lang::PaintedPolygon2D
> render1( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
) const;
556 RefCountPtr
< const Lang::PaintedPolygon2D
> render2( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
, const PtrOwner_back_Access
< std::list
< const FacetLatticeVertex
* > > & vertexMem
) const;
559 static void writePacked( std::ostream
& os
,
560 const size_t BITS_PER_COORDINATE
, const size_t BITS_PER_COMPONENT
, const size_t BITS_PER_FLAG
,
561 const double x
, const double y
, const Concrete::Gray
& color
, const unsigned char flag
);
562 static void writePackedValue( std::ostream
& os
, char * rest
, size_t * restAvail
,
563 unsigned int val
, size_t bits
);
566 class SingleSidedPolygon3DRGB
: public PaintedPolygon3D
568 RefCountPtr
< const Computation::FacetInterpolatorRGB
> interpolator_
;
569 Concrete::Length viewResolution_
;
570 Computation::FacetShadeOrder shadeOrder_
; // legal values: { 0, 1, 2 }
572 SingleSidedPolygon3DRGB( const RefCountPtr
< const Computation::FacetInterpolatorRGB
> & interpolator
,
573 bool singleSided
, // Confusingly, this type is sometimes used also for double-sided polygons.
574 const Concrete::UnitFloatTriple
& polygonUnitNormal
,
576 Concrete::Length tiebreaker
,
577 Concrete::Length viewResolution
,
578 Computation::FacetShadeOrder shadeOrder
);
579 virtual ~SingleSidedPolygon3DRGB( );
580 virtual RefCountPtr
< const Lang::PaintedPolygon2D
> polygon_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
581 virtual RefCountPtr
< const Lang::Color
> getColor( ) const; // shall only be used for debugging!
582 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
585 RefCountPtr
< const Lang::PaintedPolygon2D
> simple_polygon_to2D( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
) const;
586 RefCountPtr
< const Lang::PaintedPolygon2D
> render0( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
) const;
587 RefCountPtr
< const Lang::PaintedPolygon2D
> render1( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
) const;
588 RefCountPtr
< const Lang::PaintedPolygon2D
> render2( const Concrete::Length eyez
, const Lang::Transform3D
& tf
, const std::list
< RefCountPtr
< const Lang::LightSource
> > & lights
, PtrOwner_back_Access
< std::list
< const Computation::FacetLatticeTriangle
* > > * lattice
, const PtrOwner_back_Access
< std::list
< const FacetLatticeVertex
* > > & vertexMem
) const;
591 static void writePacked( std::ostream
& os
,
592 const size_t BITS_PER_COORDINATE
, const size_t BITS_PER_COMPONENT
, const size_t BITS_PER_FLAG
,
593 const double x
, const double y
, const Concrete::RGB
& color
, const unsigned char flag
);
594 static void writePackedValue( std::ostream
& os
, char * rest
, size_t * restAvail
,
595 unsigned int val
, size_t bits
);
603 UndirectedEdge( size_t i0
, size_t i1
)
604 : low_( i0
), high_( i1
)
612 size_t low( ) const { return low_
; }
613 size_t high( ) const { return high_
; }
614 static UndirectedEdge
begin( )
616 return UndirectedEdge( 0, 0 );
618 static UndirectedEdge
end( )
620 return UndirectedEdge( INT_MAX
, INT_MAX
);
622 void increment( size_t size
)
637 bool operator == ( const Computation::UndirectedEdge
& other
) const
639 return low_
== other
.low_
&& high_
== other
.high_
;
641 bool operator != ( const Computation::UndirectedEdge
& other
) const
643 return low_
!= other
.low_
|| high_
!= other
.high_
;
646 bool operator < ( const Computation::UndirectedEdge
& p1
, const Computation::UndirectedEdge
& p2
);
649 class UndirectedEdgeMatrix
652 std::vector
< std::vector
< T
> > mem_
;
654 UndirectedEdgeMatrix( size_t size
);
655 UndirectedEdgeMatrix( size_t size
, const T
& elem
);
656 ~UndirectedEdgeMatrix( );
657 T
& operator [] ( const UndirectedEdge
& idx
);
658 const T
& operator [] ( const UndirectedEdge
& idx
) const;
666 class Drawable2D
: public Lang::Geometric2D
669 typedef enum { BOUNDING
, BLEED
} BoxType
;
672 virtual ~Drawable2D( );
673 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const = 0;
674 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const = 0;
675 RefCountPtr
< const Lang::Transformed2D
> typed_transformed( const Lang::Transform2D
& tf
, const RefCountPtr
< const Lang::Drawable2D
> & self
) const;
676 virtual RefCountPtr
< const Lang::Geometric2D
> transformed( const Lang::Transform2D
& tf
, const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
677 virtual RefCountPtr
< const Lang::Geometric3D
> to3D( const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
678 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
679 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
680 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
686 class Group2D
: public Lang::Drawable2D
692 virtual bool isNull( ) const = 0;
693 virtual RefCountPtr
< const Lang::Group2D
> removeShallow( Lang::Symbol::KeyType key
) const = 0;
694 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bboxAdd( Lang::Drawable2D::BoxType boxType
, Concrete::Length xmin
, Concrete::Length ymin
, Concrete::Length xmax
, Concrete::Length ymax
) const = 0; /* For tail-recursive implementation of bbox. */
697 class GroupPair2D
: public Lang::Group2D
699 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
700 RefCountPtr
< const Lang::Drawable2D
> car_
;
701 RefCountPtr
< const Lang::Group2D
> cdr_
;
703 GroupPair2D( RefCountPtr
< const Lang::Drawable2D
> car
, RefCountPtr
< const Lang::Group2D
> cdr
, const RefCountPtr
< const Kernel::GraphicsState
> & metaState
);
704 virtual ~GroupPair2D( );
705 virtual bool isNull( ) const;
706 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
707 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
708 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
709 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
710 virtual RefCountPtr
< const Lang::Group2D
> removeShallow( Lang::Symbol::KeyType key
) const;
711 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bboxAdd( Lang::Drawable2D::BoxType boxType
, Concrete::Length xmin
, Concrete::Length ymin
, Concrete::Length xmax
, Concrete::Length ymax
) const;
712 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
714 RefCountPtr
< const Lang::ElementaryPath2D
> bbox( const RefCountPtr
< const Lang::ElementaryPath2D
> & carbbox
, const RefCountPtr
< const Lang::ElementaryPath2D
> & cdrbbox
) const;
717 class GroupNull2D
: public Lang::Group2D
721 virtual ~GroupNull2D( );
722 virtual bool isNull( ) const;
723 virtual RefCountPtr
< const Lang::Group2D
> removeShallow( Lang::Symbol::KeyType key
) const;
724 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bboxAdd( Lang::Drawable2D::BoxType boxType
, Concrete::Length xmin
, Concrete::Length ymin
, Concrete::Length xmax
, Concrete::Length ymax
) const;
725 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
726 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
729 class XObject
: public Lang::Drawable2D
731 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
732 RefCountPtr
< SimplePDF::PDF_Object
> resource_
;
733 RefCountPtr
< const Lang::ElementaryPath2D
> boundingbox_
;
734 RefCountPtr
< const Lang::ElementaryPath2D
> bleedbox_
;
735 std::string debugStr_
;
737 XObject( const RefCountPtr
< SimplePDF::PDF_Object
> & resource
, const RefCountPtr
< const Lang::ElementaryPath2D
> & boundingbox
);
738 XObject( const RefCountPtr
< SimplePDF::PDF_Object
> & resource
, const RefCountPtr
< const Lang::ElementaryPath2D
> & boundingbox
, const RefCountPtr
< const Lang::ElementaryPath2D
> & bleedbox
, const RefCountPtr
< const Kernel::GraphicsState
> & metaState
);
740 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
741 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
742 RefCountPtr
< const Lang::XObject
> cloneWithState( const RefCountPtr
< const Kernel::GraphicsState
> & _metaState
, Concrete::Length bleedMargin
) const;
743 void setDebugStr( const std::string
& _debugStr
);
744 const std::string
& getDebugStr( ) const;
745 virtual void show( std::ostream
& os
) const;
746 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
748 RefCountPtr
< SimplePDF::PDF_Object
> getResource( ) const;
751 class TransparencyGroup
: public Lang::XObject
753 RefCountPtr
< const Lang::ColorSpace
> colorSpace_
;
754 RefCountPtr
< SimplePDF::PDF_Indirect_out
> indirection_
;
756 TransparencyGroup( const RefCountPtr
< SimplePDF::PDF_Indirect_out
> & indirection
, RefCountPtr
< const Lang::ElementaryPath2D
> _mybbox
, const RefCountPtr
< const Lang::ColorSpace
> & colorSpace
);
757 virtual ~TransparencyGroup( );
758 RefCountPtr
< const Lang::ColorSpace
> colorSpace( ) const;
759 RefCountPtr
< SimplePDF::PDF_Indirect_out
> getPDF_Object( ) const;
762 class RasterImage
: public Lang::XObject
767 size_t size_depth_
; /* This is the number of bits used for each color channel. */
768 Concrete::Length pixelSize_x_
;
769 Concrete::Length pixelSize_y_
;
770 RefCountPtr
< const Lang::ColorSpace
> colorSpace_
;
771 RefCountPtr
< const Lang::RasterImage
> softMask_
;
773 RasterImage( const RefCountPtr
< SimplePDF::PDF_Object
> & resource
, size_t size_x
, size_t size_y
, size_t size_depth
, Concrete::Length pixelSize_x
, Concrete::Length pixelSize_y
, RefCountPtr
< const Lang::ColorSpace
> colorSpace
, RefCountPtr
< SimplePDF::PDF_Stream_out
> & stream
);
775 static RasterImage
* newInstance( size_t size_x
, size_t size_y
, size_t size_depth
, Concrete::Length pixelSize_x
, Concrete::Length pixelSize_y
, RefCountPtr
< const Lang::ColorSpace
> colorSpace
); /* Use this method instead of the constructor! */
776 void setSoftMask( const RefCountPtr
< const Lang::RasterImage
> & softMask
); /* This only stores the soft mask in the object. It does not add it to the stream dictionary. */
778 virtual ~RasterImage( );
779 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const; /* Override XObject::shipout! */
780 virtual Kernel::VariableHandle
getField( const char * fieldID
, const RefCountPtr
< const Lang::Value
> & selfRef
) const;
781 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
784 static Lang::ElementaryPath2D
* newBoundingBox( size_t size_x
, size_t size_y
, Concrete::Length pixelSize_x
, Concrete::Length pixelSize_y
);
786 RefCountPtr
< SimplePDF::PDF_Stream_out
> stream_
;
788 RefCountPtr
< SimplePDF::PDF_Stream_out
> & stream( ){ return stream_
; } /* Non-const method to be used during construction! */
791 class PaintedPath2D
: public Lang::Drawable2D
794 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
795 std::list
< RefCountPtr
< const Lang::ElementaryPath2D
> > path_
;
796 const char * paintCmd_
;
798 PaintedPath2D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
,
799 const char * paintCmd
);
800 PaintedPath2D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
,
801 RefCountPtr
< const Lang::ElementaryPath2D
> path
,
802 const char * paintCmd
);
803 PaintedPath2D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
,
804 RefCountPtr
< const Lang::MultiPath2D
> paths
,
805 const char * paintCmd
);
806 virtual ~PaintedPath2D( );
808 void addSubPath( RefCountPtr
< const Lang::ElementaryPath2D
> subpath
);
809 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
810 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
811 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
812 bool isContainedIn( const Lang::Clipped2D
* clipping
) const;
815 class PaintedPolygon2D
: public Lang::PaintedPath2D
818 PaintedPolygon2D( RefCountPtr
< const Kernel::GraphicsState
> metaState
, RefCountPtr
< const Lang::ElementaryPath2D
> path
);
819 virtual ~PaintedPolygon2D( );
820 RefCountPtr
< const Lang::Drawable2D
> clip( std::list
< Computation::ZBufTriangle
> * regions
, const RefCountPtr
< const Lang::PaintedPolygon2D
> selfRef
) const;
823 class BBoxed2D
: public Lang::PaintedPolygon2D
826 typedef enum { BOUNDING
= 0, BLEED
, BOTH
} BoxType
;
828 RefCountPtr
< const Lang::ElementaryPath2D
> mybbox_
;
829 RefCountPtr
< const Lang::Drawable2D
> element_
;
832 BBoxed2D( RefCountPtr
< const Lang::Drawable2D
> element
, RefCountPtr
< const Lang::ElementaryPath2D
> mybbox
, BoxType boxType
= BOUNDING
);
833 virtual ~BBoxed2D( );
834 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
835 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
836 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
837 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
838 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
841 class Transformed2D
: public Lang::Drawable2D
843 Lang::Transform2D mytf_
;
844 RefCountPtr
< const Lang::Drawable2D
> element_
;
846 Transformed2D( RefCountPtr
< const Lang::Drawable2D
> element
, const Lang::Transform2D
& mytf
);
847 virtual ~Transformed2D( );
848 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
849 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
850 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
851 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
852 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
855 class Clipped2D
: public Lang::Drawable2D
857 std::list
< RefCountPtr
< const Lang::ElementaryPath2D
> > clipList_
;
858 RefCountPtr
< const Lang::Drawable2D
> element_
;
859 const char * clipCommand_
;
861 Clipped2D( const RefCountPtr
< const Lang::Drawable2D
> & element
, const char * clipCommand
);
862 virtual ~Clipped2D( );
863 void addSubPath( const RefCountPtr
< const Lang::ElementaryPath2D
> & subpath
);
864 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
865 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
866 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
867 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
868 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
869 RefCountPtr
< const Lang::Drawable2D
> debugPolys( ) const;
870 bool isSingleConvexPoly( Concrete::Length tol
) const;
871 bool convexPolyContains( const Concrete::Coords2D
& p
, Concrete::Length tol
) const;
873 RefCountPtr
< const Lang::ElementaryPath2D
> bbox( const RefCountPtr
< const Lang::ElementaryPath2D
> & elem_bbox
) const;
876 class TextMasked2D
: public Lang::Drawable2D
878 RefCountPtr
< const Lang::Drawable2D
> element_
;
879 RefCountPtr
< const Lang::Text
> mask_
;
881 TextMasked2D( const RefCountPtr
< const Lang::Drawable2D
> & element
, const RefCountPtr
< const Lang::Text
> & mask
);
882 virtual ~TextMasked2D( );
883 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
884 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
885 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
886 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
887 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
890 class SoftMasked2D
: public Lang::Drawable2D
892 RefCountPtr
< const Lang::Drawable2D
> element_
;
893 RefCountPtr
< const Lang::SoftMask
> mask_
;
895 SoftMasked2D( const RefCountPtr
< const Lang::Drawable2D
> & element
, const RefCountPtr
< const Lang::SoftMask
> & mask
);
896 virtual ~SoftMasked2D( );
897 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
898 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
899 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
900 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform2D
& tf
) const;
901 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
904 class Drawable3D
: public Lang::Geometric3D
908 virtual ~Drawable3D( );
909 RefCountPtr
< const Lang::Transformed3D
> typed_transformed( const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
910 virtual RefCountPtr
< const Lang::Geometric3D
> transformed( const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Geometric3D
> & self
) const;
911 virtual RefCountPtr
< const Lang::Geometric2D
> to2D( const Kernel::PassedDyn
& dyn
, const RefCountPtr
< const Lang::Geometric3D
> & self
) const;
912 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const = 0;
913 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const = 0;
914 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
915 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
917 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
921 class Group3D
: public Lang::Drawable3D
927 virtual bool isNull( ) const = 0;
928 virtual RefCountPtr
< const Lang::Group3D
> removeShallow( Lang::Symbol::KeyType key
) const = 0;
929 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
930 virtual RefCountPtr
< const Lang::Group2D
> group_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
) const = 0;
933 class GroupPair3D
: public Lang::Group3D
935 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
936 RefCountPtr
< const Lang::Drawable3D
> car_
;
937 RefCountPtr
< const Lang::Group3D
> cdr_
;
939 GroupPair3D( const RefCountPtr
< const Lang::Drawable3D
> & car
, const RefCountPtr
< const Lang::Group3D
> & cdr
, const RefCountPtr
< const Kernel::GraphicsState
> & metaState
);
940 virtual ~GroupPair3D( );
941 virtual bool isNull( ) const;
942 virtual RefCountPtr
< const Lang::Group2D
> group_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
) const;
943 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
944 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
945 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
946 virtual RefCountPtr
< const Lang::Group3D
> removeShallow( Lang::Symbol::KeyType key
) const;
947 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
950 class GroupNull3D
: public Lang::Group3D
954 virtual ~GroupNull3D( );
955 virtual bool isNull( ) const;
956 virtual RefCountPtr
< const Lang::Group2D
> group_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
) const;
957 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
958 virtual RefCountPtr
< const Lang::Group3D
> removeShallow( Lang::Symbol::KeyType key
) const;
961 class Drawable2Din3D
: public Lang::Drawable3D
963 RefCountPtr
< const Lang::Drawable2D
> element_
;
965 Drawable2Din3D( RefCountPtr
< const Lang::Drawable2D
> element
);
966 virtual ~Drawable2Din3D( );
967 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
968 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
969 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
970 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
971 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
974 class Facing2Din3D
: public Lang::Drawable3D
976 RefCountPtr
< const Lang::Drawable2D
> element_
;
980 Facing2Din3D( RefCountPtr
< const Lang::Drawable2D
> element
, bool scale
, bool distort
);
981 virtual ~Facing2Din3D( );
982 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
983 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
984 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
985 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
986 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
989 class FacingFunction3D
: public Lang::Drawable3D
991 Kernel::PassedDyn dyn_
;
992 RefCountPtr
< const Lang::Function
> generator_
;
994 FacingFunction3D( Kernel::PassedDyn dyn
, RefCountPtr
< const Lang::Function
> generator
);
995 virtual ~FacingFunction3D( );
996 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
997 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
998 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
999 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
1000 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1003 class PaintedPath3D
: public Lang::Drawable3D
1005 RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
1006 std::list
< RefCountPtr
< const Lang::ElementaryPath3D
> > path_
;
1007 const char * paintCmd_
;
1009 Concrete::Length tiebreaker_
; // This is used to break ties in the z-buffer.
1011 PaintedPath3D( RefCountPtr
< const Kernel::GraphicsState
> metaState
,
1012 const char * paintCmd
,
1013 Concrete::Length tiebreaker
= Concrete::ZERO_LENGTH
);
1014 PaintedPath3D( RefCountPtr
< const Kernel::GraphicsState
> metaState
,
1015 RefCountPtr
< const Lang::ElementaryPath3D
> path
,
1016 const char * paintCmd
,
1017 Concrete::Length tiebreaker
= Concrete::ZERO_LENGTH
);
1018 PaintedPath3D( RefCountPtr
< const Kernel::GraphicsState
> metaState
,
1019 RefCountPtr
< const Lang::MultiPath3D
> paths
,
1020 const char * paintCmd
,
1021 Concrete::Length tiebreaker
= Concrete::ZERO_LENGTH
);
1022 virtual ~PaintedPath3D( );
1024 void addSubPath( RefCountPtr
< const Lang::ElementaryPath3D
> subpath
);
1025 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1026 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1027 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1030 class SingleSided3DGray
: public Lang::Drawable3D
1032 // This is a historical note worth to remember.
1033 // It doesn't make sense to store Computation::PaintedPolygon3D in a Lang:: object, since a Computation::PaintedPolygon3D cannot be transformed
1034 // but must be created at its final position, while a Lang:: object can be transformed.
1035 // In a class like this, one can only store stuff that enables us to create the Computation:: object later when the Transform3D is known.
1037 RefCountPtr
< const Lang::ElementaryPath3D
> points_
;
1038 RefCountPtr
< const Computation::FacetInterpolatorGray
> interpolator_
;
1040 Concrete::UnitFloatTriple polygonUnitNormal_
;
1041 Concrete::Length m_
;
1042 Concrete::Length tiebreaker_
; // This is used to break ties in the z-buffer.
1043 Concrete::Length viewResolution_
;
1044 Computation::FacetShadeOrder shadeOrder_
;
1046 SingleSided3DGray( const RefCountPtr
< const Lang::ElementaryPath3D
> & points
,
1047 const RefCountPtr
< const Computation::FacetInterpolatorGray
> & interpolator
,
1048 bool singleSided
, // Confusing, but true; this type is curretly sometimes used also for double-sided objects.
1049 const Concrete::UnitFloatTriple
& polygonUnitNormal
,
1051 Concrete::Length tiebreaker
,
1052 Concrete::Length viewResolution
,
1053 Computation::FacetShadeOrder shadeOrder
);
1054 virtual ~SingleSided3DGray( );
1056 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1057 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1058 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1061 class SingleSided3DRGB
: public Lang::Drawable3D
1063 // This is a historical note worth to remember.
1064 // It doesn't make sense to store Computation::PaintedPolygon3D in a Lang:: object, since a Computation::PaintedPolygon3D cannot be transformed
1065 // but must be created at its final position, while a Lang:: object can be transformed.
1066 // In a class like this, one can only store stuff that enables us to create the Computation:: object later when the Transform3D is known.
1068 RefCountPtr
< const Lang::ElementaryPath3D
> points_
;
1069 RefCountPtr
< const Computation::FacetInterpolatorRGB
> interpolator_
;
1071 Concrete::UnitFloatTriple polygonUnitNormal_
;
1072 Concrete::Length m_
;
1073 Concrete::Length tiebreaker_
; // This is used to break ties in the z-buffer.
1074 Concrete::Length viewResolution_
;
1075 Computation::FacetShadeOrder shadeOrder_
;
1077 SingleSided3DRGB( const RefCountPtr
< const Lang::ElementaryPath3D
> & points
,
1078 const RefCountPtr
< const Computation::FacetInterpolatorRGB
> & interpolator
,
1079 bool singleSided
, // Confusing, but true; this type is curretly sometimes used also for double-sided objects.
1080 const Concrete::UnitFloatTriple
& polygonUnitNormal
,
1082 Concrete::Length tiebreaker
,
1083 Concrete::Length viewResolution
,
1084 Computation::FacetShadeOrder shadeOrder
);
1085 virtual ~SingleSided3DRGB( );
1087 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1088 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1089 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1092 class ZBuf
: public Lang::Drawable3D
1094 const RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
1095 const RefCountPtr
< std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > > pile_
;
1096 const RefCountPtr
< std::list
< RefCountPtr
< Computation::StrokedLine3D
> > > linePile_
;
1097 const RefCountPtr
< std::list
< RefCountPtr
< const Lang::LightSource
> > > lightPile_
;
1099 ZBuf( const RefCountPtr
< std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > > & pile
, const RefCountPtr
< std::list
< RefCountPtr
< Computation::StrokedLine3D
> > > & linePile
, const RefCountPtr
< std::list
< RefCountPtr
< const Lang::LightSource
> > > & lightPile
, const RefCountPtr
< const Kernel::GraphicsState
> & metaState
);
1101 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1102 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1103 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1104 typedef std::list
< size_t > PolyIndices
;
1105 class IndexRepresentation
;
1107 static void mergeTriangles( std::list
< Computation::ZBufTriangle
> * triangles
);
1108 static void recombineTriangles( std::list
< Computation::ZBufTriangle
> * mergedTriangles
);
1110 // The return value is false if the edge was not added due to a conflict.
1111 static bool addEdge( Computation::UndirectedEdgeMatrix
< std::pair
< bool, std::list
< IndexRepresentation
* > > > * edgeMarix
, const Computation::UndirectedEdge
& edge
, IndexRepresentation
* indRep
, std::list
< Computation::UndirectedEdge
> * jobQueue
, const std::vector
< Concrete::Coords2D
> & cornerMem
);
1113 static void removeEdge( Computation::UndirectedEdgeMatrix
< std::pair
< bool, std::list
< IndexRepresentation
* > > > * edgeMarix
, const Computation::UndirectedEdge
& edge
, IndexRepresentation
* indRep
);
1114 static bool areAligned( const Concrete::Coords2D p0
, const Concrete::Coords2D p1
, const Concrete::Coords2D p2
);
1115 static bool areAlignedAndOrdered( const Concrete::Coords2D p0
, const Concrete::Coords2D p1
, const Concrete::Coords2D p2
);
1116 static void addEdges( PolyIndices
* poly
, Computation::UndirectedEdgeMatrix
< std::list
< PolyIndices
* > > * edgeMatrix
);
1117 static void addEdge( Computation::UndirectedEdgeMatrix
< std::list
< PolyIndices
* > > * edgeMatrix
, size_t ia
, size_t ib
, PolyIndices
* indRep
);
1118 static bool extendPoly( PolyIndices
* poly
, const Computation::UndirectedEdge
& edge
, size_t iNew
, Computation::UndirectedEdgeMatrix
< std::list
< PolyIndices
* > > * edgeMatrix
, const std::vector
< Concrete::Coords2D
> & cornerMem
, bool convex
);
1120 static void trianglesToPolys( std::list
< Computation::ZBufTriangle
> * triangles
, Lang::Clipped2D
* dst
);
1123 // The ZSorter class is very similar to ZBuf, but uses another algorithm to display itself
1124 class ZSorter
: public Lang::Drawable3D
1126 const RefCountPtr
< const Kernel::GraphicsState
> metaState_
;
1127 const RefCountPtr
< std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > > pile_
;
1128 const RefCountPtr
< std::list
< RefCountPtr
< Computation::StrokedLine3D
> > > linePile_
;
1129 const RefCountPtr
< std::list
< RefCountPtr
< const Lang::LightSource
> > > lightPile_
;
1131 ZSorter( const RefCountPtr
< std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > > & pile
, const RefCountPtr
< std::list
< RefCountPtr
< Computation::StrokedLine3D
> > > & linePile
, const RefCountPtr
< std::list
< RefCountPtr
< const Lang::LightSource
> > > & lightPile
, const RefCountPtr
< const Kernel::GraphicsState
> & metaState
);
1132 virtual ~ZSorter( );
1133 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1134 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1135 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1138 class Transformed3D
: public Lang::Drawable3D
1140 Lang::Transform3D mytf_
;
1141 RefCountPtr
< const Lang::Drawable3D
> element_
;
1143 Transformed3D( RefCountPtr
< const Lang::Drawable3D
> element
, const Lang::Transform3D
& mytf
);
1144 virtual ~Transformed3D( );
1145 virtual RefCountPtr
< const Lang::Drawable2D
> typed_to2D( const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1146 virtual void polygonize( std::list
< RefCountPtr
< Computation::PaintedPolygon3D
> > * zBufPile
, std::list
< RefCountPtr
< Computation::StrokedLine3D
> > * linePile
, const Kernel::PassedDyn
& dyn
, const Lang::Transform3D
& tf
, const RefCountPtr
< const Lang::Drawable3D
> & self
) const;
1147 virtual void findTags( std::vector
< Kernel::ValueRef
> * dst
, const Kernel::PassedDyn
& dyn
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
1148 virtual bool findOneTag( Kernel::EvalState
* evalState
, Lang::Symbol::KeyType key
, const Lang::Transform3D
& tf
) const;
1149 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1152 class Text
: public Lang::Drawable2D
1154 RefCountPtr
< const Kernel::TextState
> textState_
;
1155 RefCountPtr
< const std::list
< RefCountPtr
< const Lang::TextOperation
> > > elements_
;
1156 RefCountPtr
< const Lang::ElementaryPath2D
> mybbox_
;
1158 Text( const RefCountPtr
< const Kernel::TextState
> & textState
, const RefCountPtr
< const std::list
< RefCountPtr
< const Lang::TextOperation
> > > & elements
, const RefCountPtr
< const Lang::ElementaryPath2D
> & mybbox
);
1160 virtual void shipout( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
) const;
1161 void shipout_clip( std::ostream
& os
, Kernel::PageContentStates
* pdfState
, const Lang::Transform2D
& tf
, const RefCountPtr
< const Lang::Drawable2D
> & content
) const;
1162 virtual RefCountPtr
< const Lang::ElementaryPath2D
> bbox( Lang::Drawable2D::BoxType boxType
) const;
1163 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
1171 RefCountPtr
< const Lang::Group2D
>
1172 newGroup2D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
, const RefCountPtr
< const Lang::Drawable2D
> & obj2
, const RefCountPtr
< const Lang::Drawable2D
> & obj1
);
1173 RefCountPtr
< const Lang::Group2D
>
1174 newGroup2D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
, const RefCountPtr
< const Lang::Drawable2D
> & obj3
, const RefCountPtr
< const Lang::Drawable2D
> & obj2
, const RefCountPtr
< const Lang::Drawable2D
> & obj1
);
1176 RefCountPtr
< const Lang::Group3D
>
1177 newGroup3D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
, const RefCountPtr
< const Lang::Drawable3D
> & obj2
, const RefCountPtr
< const Lang::Drawable3D
> & obj1
);
1178 RefCountPtr
< const Lang::Group3D
>
1179 newGroup3D( const RefCountPtr
< const Kernel::GraphicsState
> & metaState
, const RefCountPtr
< const Lang::Drawable3D
> & obj3
, const RefCountPtr
< const Lang::Drawable3D
> & obj2
, const RefCountPtr
< const Lang::Drawable3D
> & obj1
);
1182 RefCountPtr
< const Lang::TransparencyGroup
>
1183 newTransparencyGroup( const RefCountPtr
< const Lang::Drawable2D
> & content
, bool isolated
, bool knockout
, const RefCountPtr
< const Lang::ColorSpace
> & blendSpace
);
1185 RefCountPtr
< const Lang::TransparencyGroup
>
1186 newSolidTransparencyGroup( const RefCountPtr
< const Lang::Drawable2D
> & obj2
, const RefCountPtr
< const Lang::Drawable2D
> & obj1
);
1187 RefCountPtr
< const Lang::TransparencyGroup
>
1188 newSolidTransparencyGroup( const RefCountPtr
< const Lang::Drawable2D
> & obj3
, const RefCountPtr
< const Lang::Drawable2D
> & obj2
, const RefCountPtr
< const Lang::Drawable2D
> & obj1
);
1196 ::Shapes::Computation::UndirectedEdgeMatrix
< T
>::UndirectedEdgeMatrix( size_t size
)
1199 mem_
.reserve( size_
);
1200 for( size_t row
= 0; row
< size_
; ++row
)
1202 mem_
.push_back( std::vector
< T
>( ) );
1203 mem_
.back( ).resize( size_
- row
);
1208 ::Shapes::Computation::UndirectedEdgeMatrix
< T
>::UndirectedEdgeMatrix( size_t size
, const T
& elem
)
1211 mem_
.reserve( size_
);
1212 for( size_t row
= 0; row
< size_
; ++row
)
1214 mem_
.push_back( std::vector
< T
>( ) );
1215 mem_
.back( ).resize( size_
- row
, elem
);
1220 ::Shapes::Computation::UndirectedEdgeMatrix
< T
>::~UndirectedEdgeMatrix( )
1225 ::Shapes::Computation::UndirectedEdgeMatrix
< T
>::operator [] ( const UndirectedEdge
& idx
)
1227 size_t low
= idx
.low( );
1228 return mem_
[ low
][ idx
.high( ) - low
];
1233 ::Shapes::Computation::UndirectedEdgeMatrix
< T
>::operator [] ( const UndirectedEdge
& idx
) const
1235 size_t low
= idx
.low( );
1236 return mem_
[ low
][ idx
.high( ) - low
];