#include <bone/FishSlice.hpp>
#include <bone/FishGrid.hpp>
#include <bone/FishField.hpp>
#include <grid/types/TriangularSurface.hpp>
namespace
{
class VComputeNormals : public virtual VObject,
public virtual Fish<Fiber::Slice>,
public virtual Fish<Fiber::Grid>
{
public:
BundleSlot myBundle() const
{
}
VComputeNormals(const string&name, int p, const RefPtr<VCreationPreferences>&VP)
: VObject(name, p, VP)
, theNormalVectorField( self(), "Normals")
{
}
bool update(
VRequest&R,
double precision)
override;
};
{
RefPtr<Grid> G = iG;
if (!G)
{
printf("ComputeNormals: update(): No grid!\n");
return true;
}
if (NormalsField)
{
puts("already have normals");
return true;
}
RefPtr<Field> Coords = G->CartesianPositions();
if (!Coords)
{
puts("No coord field!");
return true;
}
RefPtr<Representation> CellsAsVertices = G->CellsAsVertices(2);
if (!CellsAsVertices)
{
puts("VComputeNormals: No cells as vertices found");
return true;
}
RefPtr<TriangularSurface::NormalVectorArray_t>
VertexNormals =
TriangularSurface::computeVertexNormals(
Coords->getData(),
CellsAsVertices->getPositions()->getData()
);
return true;
}
}
namespace
{
Description(
"Compute normal vectors of a triangular surface." ) +
Url(
"http://vish.fiberbundle.net/wiki" ),
}
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Wizt::VCreatorProperty< Wizt::VCreatorProperties::URL > Url
Wizt::VCreatorProperty< Wizt::VCreatorProperties::APPLICATION > Application
Wizt::VCreatorProperty< Wizt::VCreatorProperties::DESCRIPTION > Description
Wizt::VCreatorProperty< Wizt::VCreatorProperties::SHORTHELP > Help
Wizt::VCreatorProperty< Wizt::VCreatorProperties::CATEGORY > Category
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
Definition fs/init.hpp:20
Generic template namespace class for results of find() functions throughout the Bundle.
Definition Info.hpp:17
static const char NormalVectorFieldName[]
A default name for the field that holds the normal vectors of a grid with a surface.
Definition TriangularSurface.hpp:146