FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
ModifyingPointCloudRange.cpp

Demonstrating how to modify coordinates and have their range, and respectively the bounding box, updated accordingly.

Demonstrating how to modify coordinates and have their range, and respectively the bounding box, updated accordingly.

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <eagle/ColorSpace.hpp>
#include <fiber/fiberop/Range.hpp>
#include <fiber/baseop/ExpandBBox.hpp>
#include <memcore/Timer.hpp>
#include <memcore/Console.hpp>
using namespace Fiber;
using namespace Eagle::PhysicalSpace;
int main()
{
Finit();
BundlePtr BP = new Bundle();
unlink("outfile.f5");
BP->bindTo("outfile.f5");
Representation&myCartesianRepresentation = BP[1.0]["DemoGrid"].makeCartesianRepresentation(3);
const MultiIndex<3> GridDims = MIndex(21,13,17);
RefPtr<Field>&Positions = myCartesianRepresentation[ FIBER_POSITIONS ];
{
ArrayRef<point, 3> Coordinates(GridDims);
for(auto I : GridDims)
{
point&P = Coordinates[ I ];
P.x() = I[0]*0.83;
P.y() = I[1]*0.04*I[1];
P.z() = I[2]*0.01*I[2]*I[1];
}
if (auto CoordinateCreator = Positions->createCreator(Coordinates) )
{
RefPtr<BoundingBox> BBox = ComputeBBox( Coordinates );
Console() << "Bounding box of " << GridDims << " coordinates is " << *BBox;
auto Range = DataRange<point>::retrieve( *CoordinateCreator );
Console() << "Range of " << GridDims << " coordinates is " << *Range;
Console() << " Creator Age: " << CoordinateCreator->getAge()
<< " vs. Range age: " << Range->getAge();
}
for(auto I : GridDims)
{
point&P = Coordinates[ I ];
P.x() = I[0]*0.83 *2.0 - 10.0;
P.y() = I[1]*0.04*I[1] *2.0 - 10.0;
P.z() = I[2]*0.01*I[2]*I[1]*2.0 - 10.0;
}
if (auto CoordinateCreator = Positions->getCreator())
{
Console() << " TOUCH BBOX Creator Age: " << CoordinateCreator->getAge() << " vs. Range age: "
CoordinateCreator->touch();
Console() << " RETRIEVE BBOX Creator Age: " << CoordinateCreator->getAge() << ", no more range available.";
auto Range = DataRange<point>::retrieve( *CoordinateCreator );
Console() << "Modified Range of " << GridDims << " coordinates is " << *Range;
}
RefPtr<BoundingBox> BBox = ComputeBBox( Coordinates );
Console() << "Final Bounding box of " << GridDims << " coordinates is " << *BBox;
}
return 0;
}
An array reference class, which is a convenience class for reference pointers to multidimensional mem...
Definition ArrayRef.hpp:28
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
The main entity holding all information.
Definition Bundle.hpp:173
A recursively defined multidimensional index.
Definition MultiIndex.hpp:331
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
constexpr const Ageable & getAge() const
DomainVector< Vector< color16_t, 3 >, RGB > rgb16_t
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Class for ranges of types, such as minimum/maximum.
Definition Range.hpp:379