Panda3D
 All Classes Functions Variables Enumerations
pfmFile.I
1 // Filename: pfmFile.I
2 // Created by: drose (23Dec10)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: PfmFile::is_valid
18 // Access: Published
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE bool PfmFile::
22 is_valid() const {
23  return _num_channels != 0 && (_x_size * _y_size * _num_channels <= (int)_table.size());
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: PfmFile::get_scale
28 // Access: Published
29 // Description: The "scale" is reported in the pfm header and is
30 // probably meaningless.
31 ////////////////////////////////////////////////////////////////////
32 INLINE PN_float32 PfmFile::
33 get_scale() const {
34  return _scale;
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: PfmFile::set_scale
39 // Access: Published
40 // Description: The "scale" is reported in the pfm header and is
41 // probably meaningless.
42 ////////////////////////////////////////////////////////////////////
43 INLINE void PfmFile::
44 set_scale(PN_float32 scale) {
45  _scale = scale;
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: PfmFile::has_point
50 // Access: Published
51 // Description: Returns true if there is a valid point at x, y. This
52 // always returns true unless a "no data" value has been
53 // set, in which case it returns false if the point at
54 // x, y is the "no data" value.
55 ////////////////////////////////////////////////////////////////////
56 INLINE bool PfmFile::
57 has_point(int x, int y) const {
58  return _has_point(this, x, y);
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: PfmFile::get_channel
63 // Access: Published
64 // Description: Returns the cth channel of the point value at the
65 // indicated point.
66 ////////////////////////////////////////////////////////////////////
67 INLINE PN_float32 PfmFile::
68 get_channel(int x, int y, int c) const {
69  nassertr(x >= 0 && x < _x_size &&
70  y >= 0 && y < _y_size &&
71  c >= 0 && c < _num_channels, 0.0f);
72  return _table[(y * _x_size + x) * _num_channels + c];
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: PfmFile::set_channel
77 // Access: Published
78 // Description: Replaces the cth channel of the point value at the
79 // indicated point.
80 ////////////////////////////////////////////////////////////////////
81 INLINE void PfmFile::
82 set_channel(int x, int y, int c, PN_float32 value) {
83  nassertv(x >= 0 && x < _x_size &&
84  y >= 0 && y < _y_size &&
85  c >= 0 && c < _num_channels);
86  _table[(y * _x_size + x) * _num_channels + c] = value;
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: PfmFile::get_point1
91 // Access: Published
92 // Description: Returns the 1-component point value at the indicated
93 // point.
94 ////////////////////////////////////////////////////////////////////
95 INLINE PN_float32 PfmFile::
96 get_point1(int x, int y) const {
97  nassertr(x >= 0 && x < _x_size &&
98  y >= 0 && y < _y_size, 0.0);
99  return _table[(y * _x_size + x) * _num_channels];
100 }
101 
102 ////////////////////////////////////////////////////////////////////
103 // Function: PfmFile::set_point1
104 // Access: Published
105 // Description: Replaces the 1-component point value at the indicated
106 // point.
107 ////////////////////////////////////////////////////////////////////
108 INLINE void PfmFile::
109 set_point1(int x, int y, PN_float32 point) {
110  nassertv(!cnan(point));
111  nassertv(x >= 0 && x < _x_size &&
112  y >= 0 && y < _y_size);
113  _table[(y * _x_size + x) * _num_channels] = point;
114 }
115 
116 ////////////////////////////////////////////////////////////////////
117 // Function: PfmFile::get_point2
118 // Access: Published
119 // Description: Returns the 2-component point value at the indicated
120 // point. In a 1-channel image, the channel value is in
121 // the x component.
122 ////////////////////////////////////////////////////////////////////
123 INLINE const LPoint2f &PfmFile::
124 get_point2(int x, int y) const {
125  nassertr(x >= 0 && x < _x_size &&
126  y >= 0 && y < _y_size, LPoint2f::zero());
127  return *(LPoint2f *)&_table[(y * _x_size + x) * _num_channels];
128 }
129 
130 ////////////////////////////////////////////////////////////////////
131 // Function: PfmFile::set_point2
132 // Access: Published
133 // Description: Replaces the 2-component point value at the indicated
134 // point. In a 1-channel image, the channel value is in
135 // the x component.
136 ////////////////////////////////////////////////////////////////////
137 INLINE void PfmFile::
138 set_point2(int x, int y, const LVecBase2f &point) {
139  nassertv(!point.is_nan());
140  nassertv(x >= 0 && x < _x_size &&
141  y >= 0 && y < _y_size);
142  switch (_num_channels) {
143  case 1:
144  _table[(y * _x_size + x)] = point[0];
145  break;
146 
147  case 2:
148  *(LPoint2f *)&_table[(y * _x_size + x) * _num_channels] = point;
149  break;
150 
151  case 3:
152  (*(LPoint3f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1], 0.0);
153  break;
154 
155  case 4:
156  (*(LPoint4f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1], 0.0, 0.0);
157  break;
158  }
159 }
160 
161 ////////////////////////////////////////////////////////////////////
162 // Function: PfmFile::set_point2
163 // Access: Published
164 // Description: Replaces the 2-component point value at the indicated
165 // point. In a 1-channel image, the channel value is in
166 // the x component.
167 ////////////////////////////////////////////////////////////////////
168 INLINE void PfmFile::
169 set_point2(int x, int y, const LVecBase2d &point) {
170  set_point2(x, y, LCAST(PN_float32, point));
171 }
172 
173 ////////////////////////////////////////////////////////////////////
174 // Function: PfmFile::modify_point2
175 // Access: Published
176 // Description: Returns a modifiable 2-component point value at the
177 // indicated point.
178 ////////////////////////////////////////////////////////////////////
179 INLINE LPoint2f &PfmFile::
180 modify_point2(int x, int y) {
181 #ifndef NDEBUG
182  static LPoint2f dummy_value = LPoint2f::zero();
183  nassertr(x >= 0 && x < _x_size &&
184  y >= 0 && y < _y_size, dummy_value);
185 #endif
186 
187  return *(LPoint2f *)&_table[(y * _x_size + x) * _num_channels];
188 }
189 
190 ////////////////////////////////////////////////////////////////////
191 // Function: PfmFile::get_point
192 // Access: Published
193 // Description: Returns the 3-component point value at the indicated
194 // point. In a 1-channel image, the channel value is in
195 // the x component.
196 ////////////////////////////////////////////////////////////////////
197 INLINE const LPoint3f &PfmFile::
198 get_point(int x, int y) const {
199  return get_point3(x, y);
200 }
201 
202 ////////////////////////////////////////////////////////////////////
203 // Function: PfmFile::set_point
204 // Access: Published
205 // Description: Replaces the 3-component point value at the indicated
206 // point. In a 1-channel image, the channel value is in
207 // the x component.
208 ////////////////////////////////////////////////////////////////////
209 INLINE void PfmFile::
210 set_point(int x, int y, const LVecBase3f &point) {
211  set_point3(x, y, point);
212 }
213 
214 ////////////////////////////////////////////////////////////////////
215 // Function: PfmFile::set_point
216 // Access: Published
217 // Description: Replaces the 3-component point value at the indicated
218 // point. In a 1-channel image, the channel value is in
219 // the x component.
220 ////////////////////////////////////////////////////////////////////
221 INLINE void PfmFile::
222 set_point(int x, int y, const LVecBase3d &point) {
223  set_point3(x, y, point);
224 }
225 
226 ////////////////////////////////////////////////////////////////////
227 // Function: PfmFile::modify_point
228 // Access: Published
229 // Description: Returns a modifiable 3-component point value at the
230 // indicated point.
231 ////////////////////////////////////////////////////////////////////
232 INLINE LPoint3f &PfmFile::
233 modify_point(int x, int y) {
234  return modify_point3(x, y);
235 }
236 
237 ////////////////////////////////////////////////////////////////////
238 // Function: PfmFile::get_point3
239 // Access: Published
240 // Description: Returns the 3-component point value at the indicated
241 // point. In a 1-channel image, the channel value is in
242 // the x component.
243 ////////////////////////////////////////////////////////////////////
244 INLINE const LPoint3f &PfmFile::
245 get_point3(int x, int y) const {
246  nassertr(x >= 0 && x < _x_size &&
247  y >= 0 && y < _y_size, LPoint3f::zero());
248  return *(LPoint3f *)&_table[(y * _x_size + x) * _num_channels];
249 }
250 
251 ////////////////////////////////////////////////////////////////////
252 // Function: PfmFile::set_point3
253 // Access: Published
254 // Description: Replaces the 3-component point value at the indicated
255 // point. In a 1-channel image, the channel value is in
256 // the x component.
257 ////////////////////////////////////////////////////////////////////
258 INLINE void PfmFile::
259 set_point3(int x, int y, const LVecBase3f &point) {
260  nassertv(!point.is_nan());
261  nassertv(x >= 0 && x < _x_size &&
262  y >= 0 && y < _y_size);
263  switch (_num_channels) {
264  case 1:
265  _table[(y * _x_size + x)] = point[0];
266  break;
267 
268  case 2:
269  (*(LPoint2f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1]);
270  break;
271 
272  case 3:
273  *(LPoint3f *)&_table[(y * _x_size + x) * _num_channels] = point;
274  break;
275 
276  case 4:
277  (*(LPoint4f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1], 0.0f, 0.0f);
278  break;
279  }
280 }
281 
282 ////////////////////////////////////////////////////////////////////
283 // Function: PfmFile::set_point3
284 // Access: Published
285 // Description: Replaces the 3-component point value at the indicated
286 // point. In a 1-channel image, the channel value is in
287 // the x component.
288 ////////////////////////////////////////////////////////////////////
289 INLINE void PfmFile::
290 set_point3(int x, int y, const LVecBase3d &point) {
291  set_point3(x, y, LCAST(PN_float32, point));
292 }
293 
294 ////////////////////////////////////////////////////////////////////
295 // Function: PfmFile::modify_point3
296 // Access: Published
297 // Description: Returns a modifiable 3-component point value at the
298 // indicated point.
299 ////////////////////////////////////////////////////////////////////
300 INLINE LPoint3f &PfmFile::
301 modify_point3(int x, int y) {
302 #ifndef NDEBUG
303  static LPoint3f dummy_value = LPoint3f::zero();
304  nassertr(x >= 0 && x < _x_size &&
305  y >= 0 && y < _y_size, dummy_value);
306 #endif
307 
308  return *(LPoint3f *)&_table[(y * _x_size + x) * _num_channels];
309 }
310 
311 ////////////////////////////////////////////////////////////////////
312 // Function: PfmFile::get_point4
313 // Access: Published
314 // Description: Returns the 4-component point value at the indicated
315 // point. In a 1-channel image, the channel value is in
316 // the x component.
317 ////////////////////////////////////////////////////////////////////
318 INLINE const LPoint4f &PfmFile::
319 get_point4(int x, int y) const {
320  nassertr(x >= 0 && x < _x_size &&
321  y >= 0 && y < _y_size, LPoint4f::zero());
322  return *(LPoint4f *)&_table[(y * _x_size + x) * _num_channels];
323 }
324 
325 ////////////////////////////////////////////////////////////////////
326 // Function: PfmFile::set_point4
327 // Access: Published
328 // Description: Replaces the 4-component point value at the indicated
329 // point. In a 1-channel image, the channel value is in
330 // the x component.
331 ////////////////////////////////////////////////////////////////////
332 INLINE void PfmFile::
333 set_point4(int x, int y, const LVecBase4f &point) {
334  nassertv(!point.is_nan());
335  nassertv(x >= 0 && x < _x_size &&
336  y >= 0 && y < _y_size);
337  switch (_num_channels) {
338  case 1:
339  _table[(y * _x_size + x)] = point[0];
340  break;
341 
342  case 2:
343  (*(LPoint2f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1]);
344  break;
345 
346  case 3:
347  (*(LPoint3f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1], point[2]);
348  break;
349 
350  case 4:
351  *(LPoint4f *)&_table[(y * _x_size + x) * _num_channels] = point;
352  break;
353  }
354 }
355 
356 ////////////////////////////////////////////////////////////////////
357 // Function: PfmFile::set_point4
358 // Access: Published
359 // Description: Replaces the 4-component point value at the indicated
360 // point. In a 1-channel image, the channel value is in
361 // the x component.
362 ////////////////////////////////////////////////////////////////////
363 INLINE void PfmFile::
364 set_point4(int x, int y, const LVecBase4d &point) {
365  set_point4(x, y, LCAST(PN_float32, point));
366 }
367 
368 ////////////////////////////////////////////////////////////////////
369 // Function: PfmFile::modify_point4
370 // Access: Published
371 // Description: Returns a modifiable 4-component point value at the
372 // indicated point.
373 ////////////////////////////////////////////////////////////////////
374 INLINE LPoint4f &PfmFile::
375 modify_point4(int x, int y) {
376 #ifndef NDEBUG
377  static LPoint4f dummy_value = LPoint4f::zero();
378  nassertr(x >= 0 && x < _x_size &&
379  y >= 0 && y < _y_size, dummy_value);
380 #endif
381 
382  return *(LPoint4f *)&_table[(y * _x_size + x) * _num_channels];
383 }
384 
385 ////////////////////////////////////////////////////////////////////
386 // Function: PfmFile::fill
387 // Access: Published
388 // Description: Fills the table with all of the same value.
389 ////////////////////////////////////////////////////////////////////
390 INLINE void PfmFile::
391 fill(PN_float32 value) {
392  fill(LPoint4f(value, 0.0f, 0.0f, 0.0f));
393 }
394 
395 ////////////////////////////////////////////////////////////////////
396 // Function: PfmFile::fill
397 // Access: Published
398 // Description: Fills the table with all of the same value.
399 ////////////////////////////////////////////////////////////////////
400 INLINE void PfmFile::
401 fill(const LPoint2f &value) {
402  fill(LPoint4f(value[0], value[1], 0.0f, 0.0f));
403 }
404 
405 ////////////////////////////////////////////////////////////////////
406 // Function: PfmFile::fill
407 // Access: Published
408 // Description: Fills the table with all of the same value.
409 ////////////////////////////////////////////////////////////////////
410 INLINE void PfmFile::
411 fill(const LPoint3f &value) {
412  fill(LPoint4f(value[0], value[1], value[2], 0.0f));
413 }
414 
415 ////////////////////////////////////////////////////////////////////
416 // Function: PfmFile::calc_autocrop
417 // Access: Published
418 // Description: Computes the minimum range of x and y across the PFM
419 // file that include all points. If there are no points
420 // with no_data_value in the grid--that is, all points
421 // are included--then this will return (0, get_x_size(),
422 // 0, get_y_size()).
423 ////////////////////////////////////////////////////////////////////
424 INLINE bool PfmFile::
425 calc_autocrop(LVecBase4f &range) const {
426  int x_begin, x_end, y_begin, y_end;
427  bool result = calc_autocrop(x_begin, x_end, y_begin, y_end);
428  range.set(x_begin, x_end, y_begin, y_end);
429  return result;
430 }
431 
432 ////////////////////////////////////////////////////////////////////
433 // Function: PfmFile::calc_autocrop
434 // Access: Published
435 // Description: Computes the minimum range of x and y across the PFM
436 // file that include all points. If there are no points
437 // with no_data_value in the grid--that is, all points
438 // are included--then this will return (0, get_x_size(),
439 // 0, get_y_size()).
440 ////////////////////////////////////////////////////////////////////
441 INLINE bool PfmFile::
442 calc_autocrop(LVecBase4d &range) const {
443  int x_begin, x_end, y_begin, y_end;
444  bool result = calc_autocrop(x_begin, x_end, y_begin, y_end);
445  range.set(x_begin, x_end, y_begin, y_end);
446  return result;
447 }
448 
449 ////////////////////////////////////////////////////////////////////
450 // Function: PfmFile::set_zero_special
451 // Access: Published
452 // Description: Sets the zero_special flag. When this flag is true,
453 // values of (0, 0, 0) in the pfm file are treated as a
454 // special case, and are not processed.
455 //
456 // This is a special case of set_no_data_value().
457 ////////////////////////////////////////////////////////////////////
458 INLINE void PfmFile::
459 set_zero_special(bool zero_special) {
460  if (zero_special) {
462  } else {
464  }
465 }
466 
467 ////////////////////////////////////////////////////////////////////
468 // Function: PfmFile::set_no_data_chan4
469 // Access: Published
470 // Description: Sets the no_data_chan4 flag. When this flag is true,
471 // and the pfm file has 4 channels, then a negative
472 // value in the fourth channel indicates no data. When
473 // it is false, all points are valid.
474 //
475 // This is a special case of set_no_data_value().
476 ////////////////////////////////////////////////////////////////////
477 INLINE void PfmFile::
478 set_no_data_chan4(bool chan4) {
479  if (chan4 && _num_channels == 4) {
480  _has_no_data_value = true;
481  _has_no_data_threshold = false;
482  _no_data_value.set(0.0, 0.0, 0.0, -1.0);
483  _has_point = has_point_chan4;
484  } else {
486  }
487 }
488 
489 ////////////////////////////////////////////////////////////////////
490 // Function: PfmFile::set_no_data_value
491 // Access: Published
492 // Description: Sets the special value that means "no data" when it
493 // appears in the pfm file.
494 ////////////////////////////////////////////////////////////////////
495 INLINE void PfmFile::
496 set_no_data_value(const LPoint4d &no_data_value) {
497  set_no_data_value(LCAST(PN_float32, no_data_value));
498 }
499 
500 ////////////////////////////////////////////////////////////////////
501 // Function: PfmFile::set_no_data_threshold
502 // Access: Published
503 // Description: Sets the special threshold value. Points that are
504 // below this value in all components are considered "no
505 // value".
506 ////////////////////////////////////////////////////////////////////
507 INLINE void PfmFile::
508 set_no_data_threshold(const LPoint4d &no_data_threshold) {
509  set_no_data_threshold(LCAST(PN_float32, no_data_threshold));
510 }
511 
512 ////////////////////////////////////////////////////////////////////
513 // Function: PfmFile::set_no_data_value
514 // Access: Published
515 // Description: Removes the special value that means "no data" when it
516 // appears in the pfm file. All points will thus be
517 // considered valid.
518 ////////////////////////////////////////////////////////////////////
519 INLINE void PfmFile::
521  _has_no_data_value = false;
522  _has_no_data_threshold = false;
523  _no_data_value = LPoint4f::zero();
524  _has_point = has_point_noop;
525 }
526 
527 ////////////////////////////////////////////////////////////////////
528 // Function: PfmFile::has_no_data_value
529 // Access: Published
530 // Description: Returns whether a "no data" value has been
531 // established by set_no_data_value().
532 ////////////////////////////////////////////////////////////////////
533 INLINE bool PfmFile::
535  return _has_no_data_value;
536 }
537 
538 ////////////////////////////////////////////////////////////////////
539 // Function: PfmFile::has_no_data_threshold
540 // Access: Published
541 // Description: Returns whether a "no data" threshold value has been
542 // established by set_no_data_threshold().
543 ////////////////////////////////////////////////////////////////////
544 INLINE bool PfmFile::
546  return _has_no_data_threshold;
547 }
548 
549 ////////////////////////////////////////////////////////////////////
550 // Function: PfmFile::get_no_data_value
551 // Access: Published
552 // Description: If has_no_data_value() returns true, this returns the
553 // particular "no data" value.
554 ////////////////////////////////////////////////////////////////////
555 INLINE const LPoint4f &PfmFile::
557  nassertr(_has_no_data_value, LPoint4f::zero());
558  return _no_data_value;
559 }
560 
561 ////////////////////////////////////////////////////////////////////
562 // Function: PfmFile::xform
563 // Access: Published
564 // Description: Applies the indicated transform matrix to all points
565 // in-place.
566 ////////////////////////////////////////////////////////////////////
567 INLINE void PfmFile::
568 xform(const LMatrix4d &transform) {
569  xform(LCAST(PN_float32, transform));
570 }
571 
572 ////////////////////////////////////////////////////////////////////
573 // Function: PfmFile::compute_planar_bounds
574 // Access: Published
575 // Description: Computes the minmax bounding volume of the points in
576 // 3-D space, assuming the points represent a
577 // mostly-planar surface.
578 //
579 // This algorithm works by sampling the (square)
580 // sample_radius pixels at the four point_dist corners
581 // around the center (cx - pd, cx + pd) and so on, to
582 // approximate the plane of the surface. Then all of
583 // the points are projected into that plane and the
584 // bounding volume of the entire mesh within that plane
585 // is determined. If points_only is true, the bounding
586 // volume of only those four points is determined.
587 //
588 // center, point_dist and sample_radius are in UV space,
589 // i.e. in the range 0..1.
590 ////////////////////////////////////////////////////////////////////
591 INLINE PT(BoundingHexahedron) PfmFile::
592 compute_planar_bounds(const LPoint2d &center, PN_float32 point_dist, PN_float32 sample_radius, bool points_only) const {
593  return compute_planar_bounds(LCAST(PN_float32, center), point_dist, sample_radius, points_only);
594 }
595 
596 ////////////////////////////////////////////////////////////////////
597 // Function: PfmFile::get_table
598 // Access: Public
599 // Description: This is a very low-level function that returns a
600 // read-only reference to the internal table of
601 // floating-point numbers. Use this method at your own
602 // risk.
603 ////////////////////////////////////////////////////////////////////
604 INLINE const vector_float &PfmFile::
605 get_table() const {
606  return _table;
607 }
608 
609 ////////////////////////////////////////////////////////////////////
610 // Function: PfmFile::swap_table
611 // Access: Public
612 // Description: This is a very low-level function that completely
613 // exchanges the PfmFile's internal table of
614 // floating-point numbers with whatever you supply. The
615 // provided table must have an appropriate size. Use
616 // this method at your own risk.
617 ////////////////////////////////////////////////////////////////////
618 void PfmFile::
619 swap_table(vector_float &table) {
620  _table.swap(table);
621 }
622 
623 ////////////////////////////////////////////////////////////////////
624 // Function: PfmFile::setup_sub_image
625 // Access: Private
626 // Description: Computes xmin, ymin, xmax, and ymax, based on the
627 // input parameters for copy_sub_image() and related
628 // methods.
629 ////////////////////////////////////////////////////////////////////
630 INLINE void PfmFile::
631 setup_sub_image(const PfmFile &copy, int &xto, int &yto,
632  int &xfrom, int &yfrom, int &x_size, int &y_size,
633  int &xmin, int &ymin, int &xmax, int &ymax) {
634  if (x_size < 0) {
635  x_size = copy.get_x_size() - xfrom;
636  }
637  if (y_size < 0) {
638  y_size = copy.get_y_size() - yfrom;
639  }
640 
641  if (xfrom < 0) {
642  xto += -xfrom;
643  x_size -= -xfrom;
644  xfrom = 0;
645  }
646  if (yfrom < 0) {
647  yto += -yfrom;
648  y_size -= -yfrom;
649  yfrom = 0;
650  }
651 
652  if (xto < 0) {
653  xfrom += -xto;
654  x_size -= -xto;
655  xto = 0;
656  }
657  if (yto < 0) {
658  yfrom += -yto;
659  y_size -= -yto;
660  yto = 0;
661  }
662 
663  x_size = min(x_size, copy.get_x_size() - xfrom);
664  y_size = min(y_size, copy.get_y_size() - yfrom);
665 
666  xmin = xto;
667  ymin = yto;
668 
669  xmax = min(xmin + x_size, get_x_size());
670  ymax = min(ymin + y_size, get_y_size());
671 }
PN_float32 get_scale() const
The &quot;scale&quot; is reported in the pfm header and is probably meaningless.
Definition: pfmFile.I:33
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
PN_float32 get_point1(int x, int y) const
Returns the 1-component point value at the indicated point.
Definition: pfmFile.I:96
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:1241
void set_point4(int x, int y, const LVecBase4f &point)
Replaces the 4-component point value at the indicated point.
Definition: pfmFile.I:333
This is a four-component point in space.
Definition: lpoint4.h:443
static const LPoint3f & zero()
Returns a zero-length point.
Definition: lpoint3.h:258
PN_float32 get_channel(int x, int y, int c) const
Returns the cth channel of the point value at the indicated point.
Definition: pfmFile.I:68
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase2.h:430
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase4.h:575
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:1661
This is a two-component point in space.
Definition: lpoint2.h:411
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase3.h:463
void set_no_data_chan4(bool chan4)
Sets the no_data_chan4 flag.
Definition: pfmFile.I:478
void set_point2(int x, int y, const LVecBase2f &point)
Replaces the 2-component point value at the indicated point.
Definition: pfmFile.I:138
int get_x_size() const
Returns the number of pixels in the X direction.
int get_y_size() const
Returns the number of pixels in the Y direction.
void set_point3(int x, int y, const LVecBase3f &point)
Replaces the 3-component point value at the indicated point.
Definition: pfmFile.I:259
static const LPoint4f & zero()
Returns a zero-length point.
Definition: lpoint4.h:237
void swap_table(vector_float &table)
This is a very low-level function that completely exchanges the PfmFile&#39;s internal table of floating-...
Definition: pfmFile.I:619
LPoint4f & modify_point4(int x, int y)
Returns a modifiable 4-component point value at the indicated point.
Definition: pfmFile.I:375
void set_scale(PN_float32 scale)
The &quot;scale&quot; is reported in the pfm header and is probably meaningless.
Definition: pfmFile.I:44
void set_point1(int x, int y, PN_float32 point)
Replaces the 1-component point value at the indicated point.
Definition: pfmFile.I:109
LPoint3f & modify_point3(int x, int y)
Returns a modifiable 3-component point value at the indicated point.
Definition: pfmFile.I:301
const LPoint2f & get_point2(int x, int y) const
Returns the 2-component point value at the indicated point.
Definition: pfmFile.I:124
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component, or with a special extension, 2- or 4-component.
Definition: pfmFile.h:34
bool has_point(int x, int y) const
Returns true if there is a valid point at x, y.
Definition: pfmFile.I:57
const LPoint3f & get_point3(int x, int y) const
Returns the 3-component point value at the indicated point.
Definition: pfmFile.I:245
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:105
void fill(PN_float32 value)
Fills the table with all of the same value.
Definition: pfmFile.I:391
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:1455
void set_point(int x, int y, const LVecBase3f &point)
Replaces the 3-component point value at the indicated point.
Definition: pfmFile.I:210
const LPoint4f & get_point4(int x, int y) const
Returns the 4-component point value at the indicated point.
Definition: pfmFile.I:319
static const LPoint2f & zero()
Returns a zero-length point.
Definition: lpoint2.h:224
bool has_no_data_value() const
Returns whether a &quot;no data&quot; value has been established by set_no_data_value().
Definition: pfmFile.I:534
void set_channel(int x, int y, int c, PN_float32 value)
Replaces the cth channel of the point value at the indicated point.
Definition: pfmFile.I:82
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
void xform(const LMatrix4f &transform)
Applies the indicated transform matrix to all points in-place.
Definition: pfmFile.cxx:1273
This is a four-component point in space.
Definition: lpoint4.h:91
LPoint3f & modify_point(int x, int y)
Returns a modifiable 3-component point value at the indicated point.
Definition: pfmFile.I:233
void set_zero_special(bool zero_special)
Sets the zero_special flag.
Definition: pfmFile.I:459
void clear_no_data_value()
Removes the special value that means &quot;no data&quot; when it appears in the pfm file.
Definition: pfmFile.I:520
const LPoint3f & get_point(int x, int y) const
Returns the 3-component point value at the indicated point.
Definition: pfmFile.I:198
This is a two-component point in space.
Definition: lpoint2.h:92
void set_no_data_threshold(const LPoint4f &no_data_value)
Sets the special threshold value.
Definition: pfmFile.cxx:963
LPoint2f & modify_point2(int x, int y)
Returns a modifiable 2-component point value at the indicated point.
Definition: pfmFile.I:180
bool has_no_data_threshold() const
Returns whether a &quot;no data&quot; threshold value has been established by set_no_data_threshold().
Definition: pfmFile.I:545
This defines a bounding convex hexahedron.
bool calc_autocrop(int &x_begin, int &x_end, int &y_begin, int &y_end) const
Computes the minimum range of x and y across the PFM file that include all points.
Definition: pfmFile.cxx:800
void set_no_data_value(const LPoint4f &no_data_value)
Sets the special value that means &quot;no data&quot; when it appears in the pfm file.
Definition: pfmFile.cxx:931
const LPoint4f & get_no_data_value() const
If has_no_data_value() returns true, this returns the particular &quot;no data&quot; value. ...
Definition: pfmFile.I:556