14#include <nlohmann/json.hpp>
33REveShape::REveShape(
const std::string &
n,
const std::string &t) :
110 out << t <<
"SetFillColor(" <<
fFillColor <<
");\n";
111 out << t <<
"SetLineColor(" <<
fLineColor <<
");\n";
112 out << t <<
"SetLineWidth(" <<
fLineWidth <<
");\n";
131 for (
Int_t i = 1; i <
N; ++i)
133 if (pin[i].fY < pin[min_point].fY || (pin[i].fY == pin[min_point].fY && pin[i].fX < pin[min_point].fX))
138 std::vector<Float_t> angles(
N);
139 for (
Int_t i = 0; i <
N; ++i)
141 angles[i] = (pin[i] - pin[min_point]).Phi();
143 std::vector<Int_t> idcs(
N);
150 std::vector<Int_t> new_idcs;
151 new_idcs.push_back(idcs[0]);
152 auto a = idcs.begin(); ++
a;
154 while (
b != idcs.end())
158 if (pin[idcs[0]].SquareDistance(pin[*
a]) < pin[idcs[0]].SquareDistance(pin[*
b]))
163 new_idcs.push_back(*
a);
168 new_idcs.push_back(*
a);
175 std::vector<Int_t> hull;
178 hull.push_back(idcs[0]);
179 hull.push_back(idcs[1]);
180 hull.push_back(idcs[2]);
185 Int_t n = hull.size() - 1;
186 if ((pin[hull[
n]] - pin[hull[
n-1]]).
Cross(pin[idcs[i]] - pin[hull[
n]]) > 0)
188 hull.push_back(idcs[i]);
200 ::Warning(
"REveShape::FindConvexHull()",
"Polygon reduced to %d points. for '%s'.",
201 N, caller ? caller->
GetCName() :
"unknown");
207 Int_t Nold = pout.size();
208 pout.resize(Nold +
N);
209 for (
Int_t i = 0; i <
N; ++i)
211 pout[Nold + i] = pin[hull[i]];
235 return up.
Dot(
f1.Cross(f2)) < 0;
250 return up.
Dot(
f1.Cross(f2)) < 0;
260 std::swap(
box[1],
box[3]);
261 std::swap(
box[5],
box[7]);
272 std::swap(
box[1][0],
box[3][0]);
273 std::swap(
box[1][1],
box[3][1]);
274 std::swap(
box[1][2],
box[3][2]);
275 std::swap(
box[5][0],
box[7][0]);
276 std::swap(
box[5][1],
box[7][1]);
277 std::swap(
box[5][2],
box[7][2]);
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TGLVector3 Cross(const TGLVector3 &v1, const TGLVector3 &v2)
void SetMainColorPtr(Color_t *colptr)
Bool_t fCanEditMainTransparency
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
const char * GetCName() const
virtual void WriteVizParams(std::ostream &out, const TString &var)
Write-out visual parameters for this object.
static const std::string & ToString(Bool_t b)
Convert Bool_t to string - kTRUE or kFALSE.
virtual void CopyVizParams(const REveElement *el)
Copy visualization parameters from element el.
virtual void SetMainColor(Color_t color)
Set main color of the element.
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
static Int_t FindConvexHull(const vVector2_t &pin, vVector2_t &pout, REveElement *caller=nullptr)
Determines the convex-hull of points in pin.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
std::vector< REveVector2 > vVector2_t
static void CheckAndFixBoxOrientationFv(Float_t box[8][3])
Make sure box orientation is consistent with standard arrangement.
virtual ~REveShape()
Destructor.
static Bool_t IsBoxOrientationConsistentEv(const REveVector box[8])
Checks if the first face normal is pointing into the other direction as the vector pointing towards t...
static Bool_t IsBoxOrientationConsistentFv(const Float_t box[8][3])
Checks if the first face normal is pointing into the other direction as the vector pointing towards t...
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
static void CheckAndFixBoxOrientationEv(REveVector box[8])
Make sure box orientation is consistent with standard arrangement.
void SetMainColor(Color_t color) override
Set main color.
TT Dot(const REveVectorT &a) const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
basic_json< std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, double, std::allocator, adl_serializer, std::vector< std::uint8_t > > json