This file is indexed.

/usr/include/ossim/base/ossimDrect.h is in libossim-dev 1.8.16-4ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
//*******************************************************************
// Copyright (C) 2000 ImageLinks Inc.
//
// License:  LGPL
// 
// See LICENSE.txt file in the top level directory for more details.
//
// Author:  David Burken
//
// Description:
//
// Contains class declaration for drect.
// Container class for four double points representing a rectangle.
// 
//*******************************************************************
//  $Id: ossimDrect.h 22197 2013-03-12 02:00:55Z dburken $

#ifndef ossimDrect_HEADER
#define ossimDrect_HEADER

#include <iosfwd>
#include <vector>

#include <ossim/base/ossimDpt.h>
#include <ossim/base/ossimIpt.h>
#include <ossim/base/ossimFpt.h>

//***
// NOTE:  A word on corner points...
//
// There is the concept of "pixel is area" and "pixel is point".
// - Pixel is area means the (x,y) pixel coordinate refers to the upper left
//   corner of the pixel, NOT the center of the pixel.
// - Pixel is point means the (x,y) pixel coordinate refers to the center
//   of the pixel, NOT the upper left corner.
//
// For the uniformity purposes, all pixel points  should be in the
// "pixel is point" form; therefore, the (x,y) point should represent the
// CENTER of the pixel.
//***

//***
// Forward class declarations.
//***
class ossimIrect;
class ossimPolygon;
class ossimKeywordlist;

//*******************************************************************
// CLASS:  ossimDrect
//*******************************************************************

class OSSIMDLLEXPORT ossimDrect
{
public:
   enum
   {
      UPPER_LEFT  = 1,
      LOWER_LEFT  = 2,
      LOWER_RIGHT = 4,
      UPPER_RIGHT = 8
   };

   ossimDrect()
      :
         theUlCorner(0.0, 0.0),
         theUrCorner(0.0, 0.0),
         theLrCorner(0.0, 0.0),
         theLlCorner(0.0, 0.0),
         theOrientMode(OSSIM_LEFT_HANDED)
      {}

   ossimDrect(const ossimDpt&   ul_corner,
              const ossimDpt&   lr_corner,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED)
      :
         theUlCorner(ul_corner),
         theUrCorner(lr_corner.x, ul_corner.y),
         theLrCorner(lr_corner),
         theLlCorner(ul_corner.x, lr_corner.y),
         theOrientMode(mode)
      {
      }

   ossimDrect(const double& ul_corner_x,
              const double& ul_corner_y,
              const double& lr_corner_x,
              const double& lr_corner_y,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED)
      :
         theUlCorner(ul_corner_x, ul_corner_y),
         theUrCorner(lr_corner_x, ul_corner_y),
         theLrCorner(lr_corner_x, lr_corner_y),
         theLlCorner(ul_corner_x, lr_corner_y),
         theOrientMode(mode)
      {}
   
   ossimDrect(const ossimDrect& rect)
      :
         theUlCorner(rect.ul()),
         theUrCorner(rect.ur()),
         theLrCorner(rect.lr()),
         theLlCorner(rect.ll()),
         theOrientMode(rect.orientMode())
      {}

   ossimDrect(const ossimIrect& rect);

   /*!
    * Must compute a bounding rect given a collection of points or polygon:
    */
   ossimDrect(const std::vector<ossimDpt>& points,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);
   ossimDrect(const ossimDpt& p1,
              const ossimDpt& p2,
              const ossimDpt& p3,
              const ossimDpt& p4,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);
   ossimDrect(const ossimPolygon& polygon, 
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);

   /** destructor */
   ~ossimDrect();
   
   //! Constructs an Drect surrounding the specified point, and of specified size.
   ossimDrect(const ossimDpt& center, 
              const double&   size_x, 
              const double&   size_y,
              ossimCoordSysOrientMode mode=OSSIM_LEFT_HANDED);

   inline const ossimDrect& operator=  (const ossimDrect& rect);
   const ossimDrect&        operator=  (const ossimIrect& rect);
   inline bool              operator!= (const ossimDrect& rect) const;
   inline bool              operator== (const ossimDrect& rect) const;

   friend ossimDrect operator*(double scalar, const ossimDrect& rect)
   {
      ossimDpt ul(rect.theUlCorner.x*scalar,
                  rect.theUlCorner.y*scalar);
      
      if(rect.theOrientMode == OSSIM_LEFT_HANDED)
      {
         return ossimDrect(ul.x,
                           ul.y,
                           ul.x+rect.width()*scalar-1,
                           ul.y+rect.height()*scalar-1,
                           rect.theOrientMode);
      }
      return ossimDrect(ul.x,
                        ul.y,
                        ul.x+rect.width()*scalar-1,
                        ul.y-(rect.height()*scalar-1),
                        rect.theOrientMode);
      
   }
   
   const ossimDrect& operator *=(double scalar)
      {
          ossimDpt ul(theUlCorner.x*scalar,
                      theUlCorner.y*scalar);

          if(theOrientMode == OSSIM_LEFT_HANDED)
          {
             *this = ossimDrect(ul.x,
                                ul.y,
                                (ul.x+width()*scalar-1),
                                (ul.y+height()*scalar-1),
                                theOrientMode);
          }
          else
          {
             *this = ossimDrect(ul.x,
                                ul.y,
                                (ul.x+width()*scalar-1),
                                (ul.y-(height()*scalar-1)),
                                theOrientMode);
                                
          }
         return *this;
      }
   
   ossimDrect operator *(double scalar)const
      {
         ossimDpt ul((theUlCorner.x*scalar),
                     (theUlCorner.y*scalar));

         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            return ossimDrect(ul.x,
                              ul.y,
                              (ul.x+width()*scalar-1),
                              (ul.y+height()*scalar-1),
                              theOrientMode);
         }

         return ossimDrect(ul.x,
                           ul.y,
                           (ul.x+width()*scalar-1),
                           ul.y-(height()*scalar-1),
                           theOrientMode);
      }
   const ossimDrect& operator *=(const ossimDpt& scalar)
      {
         ossimDpt ul((theUlCorner.x*scalar.x),
                     (theUlCorner.y*scalar.y));
         
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            *this = ossimDrect(ul.x,
                               ul.y,
                               (ul.x+width()*scalar.x - 1),
                               (ul.y+height()*scalar.y - 1),
                               theOrientMode);
         }
         else
         {
            *this = ossimDrect(ul.x,
                               ul.y,
                               (ul.x+width()*scalar.x - 1),
                               (ul.y-(height()*scalar.y - 1)),
                               theOrientMode);            
         }
         return *this;
      }
   
   ossimDrect operator *(const ossimDpt& scalar)const
      {
         ossimDpt ul((theUlCorner.x*scalar.x),
                     (theUlCorner.y*scalar.y));
         
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            return ossimDrect(ul.x,
                              ul.y,
                              (ul.x+width()*scalar.x-1),
                              (ul.y+height()*scalar.y-1),
                              theOrientMode);
         }
         return ossimDrect(ul.x,
                           ul.y,
                           (ul.x+width()*scalar.x-1),
                           (ul.y-(height()*scalar.y-1)),
                           theOrientMode);
      }
   const ossimDrect& operator +=(const ossimDpt& shift)
      {
         ossimDpt ul((theUlCorner.x+shift.x),
                     (theUlCorner.y+shift.y));
                     
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            *this = ossimDrect(ul.x,
                               ul.y,
                               ul.x+width()-1,
                               ul.y+height()-1,
                               theOrientMode);
         }
         else
         {
            *this = ossimDrect(ul.x,
                               ul.y,
                               ul.x+width()-1,
                               ul.y-(height()-1),
                               theOrientMode);            
         }
         return *this;
      }
   
   const ossimDrect& operator -=(const ossimDpt& shift)
      {
         ossimDpt ul((theUlCorner.x-shift.x),
                     (theUlCorner.y-shift.y));
         
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            *this = ossimDrect(ul.x,
                               ul.y,
                               ul.x+width()-1,
                               ul.y+height()-1,
                               theOrientMode);
         }
         else
         {
            *this = ossimDrect(ul.x,
                               ul.y,
                               ul.x+width()-1,
                               ul.y-(height()-1),
                               theOrientMode);
         }
         return *this;
      }
   
   ossimDrect operator +(const ossimDpt& shift)const
      {
         ossimDpt ul((theUlCorner.x+shift.x),
                     (theUlCorner.y+shift.y));
                     
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            return ossimDrect(ul.x,
                              ul.y,
                              ul.x+width()-1,
                              ul.y+height()-1,
                              theOrientMode);
         }
         else
         {
            return ossimDrect(ul.x,
                              ul.y,
                              ul.x+width()-1,
                              ul.y-(height()-1),
                              theOrientMode);
         }
      }  

   ossimDrect operator -(const ossimDpt& shift)const
      {
         ossimIpt ul(ossim::round<int>(theUlCorner.x-shift.x),
                     ossim::round<int>(theUlCorner.y-shift.y));
                     
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            return ossimDrect(ul.x,
                              ul.y,
                              ul.x+width()-1,
                              ul.y+height()-1,
                              theOrientMode);
         }
         else
         {
            return ossimDrect(ul.x,
                              ul.y,
                              ul.x+width()-1,
                              ul.y-(height()-1),
                              theOrientMode);            
         }
      }  

   const ossimDpt& ul() const { return theUlCorner; }
   const ossimDpt& ur() const { return theUrCorner; }
   const ossimDpt& lr() const { return theLrCorner; }
   const ossimDpt& ll() const { return theLlCorner; }

   const ossimDrect& changeOrientationMode(ossimCoordSysOrientMode mode)
   {
      // if we are already in the orientation then return
      //
      if(mode == theOrientMode) return *this;
      if(mode == OSSIM_LEFT_HANDED)
      {
         // we must be right handed so change to left handed
         *this = ossimDrect(theUlCorner.x,
                            theLlCorner.y,
                            theLrCorner.x,
                            theUlCorner.y,
                            OSSIM_LEFT_HANDED);
      }
      else
      {
         // we must be left handed so change to RIGHT handed
         *this = ossimDrect(theUlCorner.x,
                            theLlCorner.y,
                            theLrCorner.x,
                            theUlCorner.y,
                            OSSIM_RIGHT_HANDED);
      }
      theOrientMode = mode;
      
      return *this;
   }
   
   void getBounds(double& minx, double& miny,
                  double& maxx, double& maxy)const
      {
         minx = theUlCorner.x;
         maxx = theUrCorner.x;
         if(theOrientMode == OSSIM_LEFT_HANDED)
         {
            miny = theUlCorner.y;
            maxy = theLrCorner.y;
         }
         else
         {
            maxy = theUlCorner.y;
            miny = theLrCorner.y;
         }
      }
   void makeNan()
      {
         theUlCorner.makeNan();
         theLlCorner.makeNan();
         theLrCorner.makeNan();
         theUrCorner.makeNan();
      }
   
   bool hasNans()const{ return (theUlCorner.hasNans() ||
                                theLlCorner.hasNans() ||
                                theLrCorner.hasNans() ||
                                theUrCorner.hasNans());}
   
   bool isNan()const{ return (theUlCorner.hasNans() &&
                              theLlCorner.hasNans() &&
                              theLrCorner.hasNans() &&
                              theUrCorner.hasNans());}

   double area()const
      {
         return width()*height();
      }
   //***
   // This class supports both left and right-handed coordinate systems. For
   // both, the positive x-axis extends to the "right".
   //***
   ossimCoordSysOrientMode orientMode() const { return theOrientMode; }
   void setOrientMode(ossimCoordSysOrientMode mode) { theOrientMode = mode; }
   
   /*!
    * Sets the upper left corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   inline void set_ul(const ossimDpt& pt);

   /*!
    * Sets the upper right corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   inline void set_ur(const ossimDpt& pt);

   /*!
    * Sets the lower right corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   inline void set_lr(const ossimDpt& pt);

   /*!
    * Sets the lower left corner to "pt".  Adjusts the remaining corners
    * accordingly.
    */
   inline void set_ll(const ossimDpt& pt);

   /*!
    * Sets the upper left x.  Adjusts the remaining corners accordingly.
    */
   inline void set_ulx(ossim_float64 x);

   /*!
    * Sets the upper left y.  Adjusts the remaining corners accordingly.
    */
   inline void set_uly(ossim_float64 y);

   /*!
    * Sets the upper right x.  Adjusts the remaining corners accordingly.
    */
   inline void set_urx(ossim_float64 x);

   /*!
    * Sets the upper right y.  Adjusts the remaining corners accordingly.
    */
   inline void set_ury(ossim_float64 y);

   /*!
    * Sets the lower right x.  Adjusts the remaining corners accordingly.
    */
   inline void set_lrx(ossim_float64 x);

   /*!
    * Sets the lower right y.  Adjusts the remaining corners accordingly.
    */
   inline void set_lry(ossim_float64 y);

   /*!
    * Sets the lower left x.  Adjusts the remaining corners accordingly.
    */
   inline void set_llx(ossim_float64 x);

   /*!
    * Sets the lower left y.  Adjusts the remaining corners accordingly.
    */
   inline void set_lly(ossim_float64 y);

   /*!
    * METHOD: initBoundingRect(points)
    * Initializes this rect to the bounding rect containing all points in the
    * collection passed in.
    */
   void initBoundingRect(const std::vector<ossimDpt>& points);

   /*!
    * Returns true if "pt" falls within rectangle.  Fall on an edge is also
    * considered to be within.  The edge is expanded by epsilon value so any value
    * within epsilon is inside
    */
   bool pointWithin(const ossimDpt& pt, double epsilon=0.0) const;

   /*!
    * Returns true if "pt" falls within rectangle.  Fall on an edge is also
    * considered to be within.
    */
   bool pointWithin(const ossimFpt& pt, double epsilon=0.0) const;

   /*!
    * Returns true if any portion of an input rectangle "rect" intersects
    * "this" rectangle.  
    */
   bool intersects(const ossimDrect& rect) const;

   /*!
    * Returns true if "this" rectangle is contained completely within the
    * input rectangle "rect".
    */
   bool completely_within(const ossimDrect& rect) const;

   ossimCoordSysOrientMode orientationMode()const{return theOrientMode;}
   /*!
    * Returns the height of a rectangle.
    */
   ossim_float64 height() const { return fabs(theLlCorner.y - theUlCorner.y) + 1.0; }

   /*!
    * Returns the width of a rectangle.
    */
   ossim_float64 width()  const { return fabs(theLrCorner.x - theLlCorner.x) + 1.0; }

   ossimDpt size() const { return ossimDpt(width(), height()); }

   /*!
    * Stretches this rectangle out to integer boundaries.
    */
   void stretchOut();

   /*!
    * Will stretch the rect to the passed in tiled boundary.
    */
   void stretchToTileBoundary(const ossimDpt& widthHeight);

   const ossimDrect& expand(const ossimDpt& padding);

   /**
    * @return ossimString representing ossimIrect.
    *
    * Format:  ( 30, -90, 512, 512, [LH|RH] )
    *            -x- -y-  -w-  -h-   -Right or left handed-
    *
    * where:
    *     x and y are origins either upper left if LEFT HANDED (LH) or
    *                                lower left if RIGHT HANDED (RH)
    *     w and h are width and height respectively
    *     The last value is LH or RH to indicate LeftHanded or RightHanded
    *    
    */
   ossimString toString()const;
   /**
    * expected Format:  form 1: ( 30, -90, 512, 512, [LH|RH] )
    *                            -x- -y-  -w-  -h-   -Right or left handed-
    * 
    *                   form 2: ( 30, -90, 512, 512)
    *                            -x- -y-  -w-  -h-
    *
    * NOTE: Form 2 assumes Left handed were x,y is origin upper left and y positive down.
    *
    * This method starts by doing a "makeNan" on rect. 
    *
    * @param rectString String to initialize from.
    * @return true or false to indicate successful parsing.
    */
   bool toRect(const ossimString& rectString);

   bool saveState(ossimKeywordlist& kwl,
                  const char* prefix=0)const;
   bool loadState(const ossimKeywordlist& kwl,
                  const char* prefix=0);

   /*!
    * Will subdivide this rect into four partitions.
    */
   void splitToQuad(ossimDrect& ulRect,
                    ossimDrect& urRect,
                    ossimDrect& lrRect,
                    ossimDrect& llRect);
   
   /*!
   * Finds the point on the rect boundary that is closest to the arg_point. Closest is defined as
   * the minimum perpendicular distance.
   */
   ossimDpt findClosestEdgePointTo(const ossimDpt& arg_point) const;
   
   ossimDrect clipToRect(const ossimDrect& rect)const;

   inline ossimDpt midPoint()const;

   void print(std::ostream& os) const;

   ossimDrect combine(const ossimDrect& rect)const;
   
   friend OSSIMDLLEXPORT std::ostream& operator<<(std::ostream& os,
                                                  const ossimDrect& rect);

   bool clip(ossimDpt &p1,
             ossimDpt  &p2)const;

   static long getCode(const ossimDpt& aPoint,
                       const ossimDrect& clipRect);
private:

   enum ossimCohenSutherlandClipCodes
   {
      NONE   = 0,
      LEFT   = 1,
      RIGHT  = 2,
      BOTTOM = 4,
      TOP    = 8
   };
   
   //***
   // Private data members representing the rectangle corners.
   //***
   ossimDpt theUlCorner;
   ossimDpt theUrCorner;
   ossimDpt theLrCorner;
   ossimDpt theLlCorner;

   ossimCoordSysOrientMode  theOrientMode;
};

//*******************************************************************
// Inline Method: ossimDrect::operator=(ossimDrect)
//*******************************************************************
inline const ossimDrect& ossimDrect::operator=(const ossimDrect& rect)
{
   if (this != &rect)
   {
      theUlCorner   = rect.theUlCorner;
      theUrCorner   = rect.theUrCorner;
      theLrCorner   = rect.theLrCorner;
      theLlCorner   = rect.theLlCorner;
      theOrientMode = rect.theOrientMode;
   }

   return *this;
}

//*******************************************************************
// Inline Method: ossimDrect::operator!=
//*******************************************************************
inline bool ossimDrect::operator!=(const ossimDrect& rect) const
{
   return ( (theUlCorner   != rect.theUlCorner) ||
            (theUrCorner   != rect.theUrCorner) ||
            (theLrCorner   != rect.theLrCorner) ||
            (theLlCorner   != rect.theLlCorner) ||
            (theOrientMode != rect.theOrientMode));
}

//*******************************************************************
// Inline Method: ossimDrect::operator==
//*******************************************************************
inline bool ossimDrect::operator==(const ossimDrect& rect) const
{
   return ( (theUlCorner   == rect.theUlCorner) &&
            (theUrCorner   == rect.theUrCorner) &&
            (theLrCorner   == rect.theLrCorner) &&
            (theLlCorner   == rect.theLlCorner) &&
            (theOrientMode == rect.theOrientMode));
}

//*******************************************************************
// Inline Method: ossimDrect::set_ul
//*******************************************************************
inline void ossimDrect::set_ul(const ossimDpt& pt)
{
   theUlCorner   = pt;
   theUrCorner.y = pt.y;
   theLlCorner.x = pt.x;
}

//*******************************************************************
// Inline Method: ossimDrect::set_ur
//*******************************************************************
inline void ossimDrect::set_ur(const ossimDpt& pt)
{
   theUrCorner   = pt;
   theUlCorner.y = pt.y;
   theLrCorner.x = pt.x;
}

//*******************************************************************
// Inline Method: ossimDrect::set_lr
//*******************************************************************
inline void ossimDrect::set_lr(const ossimDpt& pt)
{
   theLrCorner   = pt;
   theUrCorner.x = pt.x;
   theLlCorner.y = pt.y;
}

//*******************************************************************
// Inline Method: ossimDrect::set_ll
//*******************************************************************
inline void ossimDrect::set_ll(const ossimDpt& pt)
{
   theLlCorner   = pt;
   theUlCorner.x = pt.x;
   theLrCorner.y = pt.y;
}

//*******************************************************************
// Inline Method: ossimDrect::set_ulx
//*******************************************************************
inline void ossimDrect::set_ulx(ossim_float64 x)
{
   theUlCorner.x = x;
   theLlCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimDrect::set_uly
//*******************************************************************
inline void ossimDrect::set_uly(ossim_float64 y)
{
   theUlCorner.y = y;
   theUrCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimDrect::set_urx
//*******************************************************************
inline void ossimDrect::set_urx(ossim_float64 x)
{
   theUrCorner.x = x;
   theLrCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimDrect::set_ury
//*******************************************************************
inline void ossimDrect::set_ury(ossim_float64 y)
{
   theUrCorner.y = y;
   theUlCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimDrect::set_lrx
//*******************************************************************
inline void ossimDrect::set_lrx(ossim_float64 x)
{
   theLrCorner.x = x;
   theUrCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimDrect::set_lry
//*******************************************************************
inline void ossimDrect::set_lry(ossim_float64 y)
{
   theLrCorner.y = y;
   theLlCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimDrect::set_llx
//*******************************************************************
inline void ossimDrect::set_llx(ossim_float64 x)
{
   theLlCorner.x = x;
   theUlCorner.x = x;
}

//*******************************************************************
// Inline Method: ossimDrect::set_lly
//*******************************************************************
inline void ossimDrect::set_lly(ossim_float64 y)
{
   theLlCorner.y = y;
   theLrCorner.y = y;
}

//*******************************************************************
// Inline Method: ossimDrect::pointWithin(const ossimDpt& pt) 
//*******************************************************************
inline bool ossimDrect::pointWithin(const ossimDpt& pt, double epsilon) const
{
   if (theOrientMode == OSSIM_LEFT_HANDED)
   {
      return ((pt.x >= (ul().x-epsilon)) &&
              (pt.x <= (ur().x+epsilon)) &&
              (pt.y >= (ul().y-epsilon)) &&
              (pt.y <= (ll().y+epsilon)));
   }
   return ((pt.x >= (ul().x-epsilon)) &&
           (pt.x <= (ur().x+epsilon)) &&
           (pt.y <= (ul().y+epsilon)) &&
           (pt.y >= (ll().y-epsilon)));
}

//*******************************************************************
// Inline Method: ossimDrect::pointWithin(const ossimFpt& pt)
//*******************************************************************
inline bool ossimDrect::pointWithin(const ossimFpt& pt, double epsilon) const
{
   if (theOrientMode == OSSIM_LEFT_HANDED)
   {
      return ((pt.x >= (ul().x-epsilon)) &&
              (pt.x <= (ur().x+epsilon)) &&
              (pt.y >= (ul().y-epsilon)) &&
              (pt.y <= (ll().y+epsilon)));
   }
   return ((pt.x >= (ul().x-epsilon)) &&
           (pt.x <= (ur().x+epsilon)) &&
           (pt.y <= (ul().y+epsilon)) &&
           (pt.y >= (ll().y-epsilon)));
}

//*******************************************************************
// Inline Method: ossimDrect::midPoint()
//*******************************************************************
inline ossimDpt ossimDrect::midPoint()const
{
   return ossimDpt( (ul().x + ur().x + ll().x + lr().x)*.25,
                    (ul().y + ur().y + ll().y + lr().y)*.25);
}

//*******************************************************************
// Inline Method: ossimDrect::combine(const ossimDrect& rect)
//*******************************************************************
inline ossimDrect ossimDrect::combine(const ossimDrect& rect)const
{
   if(rect.hasNans() || hasNans())
   {
      ossimDrect result;

      result.makeNan();

      return result;
   }
   if (theOrientMode != rect.theOrientMode)
      return(*this);
   
   ossimDpt ulCombine;
   ossimDpt lrCombine;

   if(theOrientMode == OSSIM_LEFT_HANDED)
   {
      ulCombine.x = ((ul().x <= rect.ul().x)?ul().x:rect.ul().x);
      ulCombine.y = ((ul().y <= rect.ul().y)?ul().y:rect.ul().y);
      lrCombine.x = ((lr().x >= rect.lr().x)?lr().x:rect.lr().x);
      lrCombine.y = ((lr().y >= rect.lr().y)?lr().y:rect.lr().y);
   }
   else
   {
      ulCombine.x = ((ul().x <= rect.ul().x)?ul().x:rect.ul().x);
      ulCombine.y = ((ul().y >= rect.ul().y)?ul().y:rect.ul().y);
      lrCombine.x = ((lr().x >= rect.lr().x)?lr().x:rect.lr().x);
      lrCombine.y = ((lr().y <= rect.lr().y)?lr().y:rect.lr().y);
   }

   return ossimDrect(ulCombine, lrCombine, theOrientMode);
}
#endif