File: ObjectBounds3D.cpp

package info (click to toggle)
ausaxs 1.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 72,592 kB
  • sloc: cpp: 49,853; ansic: 6,901; python: 730; makefile: 18
file content (28 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download
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
// SPDX-License-Identifier: LGPL-3.0-or-later
// Author: Kristian Lytje

#include <em/ObjectBounds3D.h>
#include <em/ObjectBounds2D.h>
#include <utility/Limit.h>

#include <numeric>

using namespace ausaxs::em;

ObjectBounds3D::ObjectBounds3D(unsigned int size_x, unsigned int size_y, unsigned int size_z) : bounds(size_z, ObjectBounds2D(size_x, size_y)), _size_x(size_x), _size_y(size_y), _size_z(size_z) {}

ObjectBounds3D::~ObjectBounds3D() = default;

ObjectBounds2D& ObjectBounds3D::operator[](unsigned int z) {return bounds[z];}

const ObjectBounds2D& ObjectBounds3D::operator[](unsigned int z) const {return bounds[z];}

unsigned int ObjectBounds3D::total_volume() const {return _size_x*_size_y*_size_z;}

unsigned int ObjectBounds3D::bounded_volume() const {return std::accumulate(bounds.begin(), bounds.end(), 0, [] (unsigned int volume, const ObjectBounds2D& bound) {return volume += bound.bounded_area();});}

unsigned int ObjectBounds3D::size_x() const {return _size_x;}

unsigned int ObjectBounds3D::size_y() const {return _size_y;}

unsigned int ObjectBounds3D::size_z() const {return _size_z;}