#ifndef NXS_NORMALS_CONE_H #define NXS_NORMALS_CONE_H #include #include #include namespace nxs { //anchored normal cone. class ANCone3f { public: ANCone3f(); bool Frontface(const vcg::Point3f &viewPoint); bool Backface(const vcg::Point3f &viewPoint); //threshold [0, 1]: percentage of normals to left out void AddNormals(std::vector &normals, float threshold = 1.0f); void AddNormals(std::vector &normals, std::vector &areas, float threshold = 1.0f); void AddAnchors(std::vector &anchors); protected: vcg::Point3f scaledNormal; vcg::Point3f frontAnchor; vcg::Point3f backAnchor; friend class NCone3s; }; //this is not anchored... need a bounding sphere to report something class NCone3s { public: void Import(const ANCone3f &c); bool Backface(const vcg::Sphere3f &sphere, const vcg::Point3f &view) const; bool Frontface(const vcg::Sphere3f &sphere, const vcg::Point3f &view) const; //encode normal and sin(alpha) in n[3] short n[4]; }; } #endif