14#include <nlohmann/json.hpp>
33REveShape::REveShape(
const std::string &
n,
const std::string &t) :
106 out << t <<
"SetFillColor(" <<
fFillColor <<
");\n";
107 out << t <<
"SetLineColor(" <<
fLineColor <<
");\n";
108 out << t <<
"SetLineWidth(" <<
fLineWidth <<
");\n";
127 for (
Int_t i = 1; i <
N; ++i)
129 if (pin[i].fY < pin[min_point].fY || (pin[i].fY == pin[min_point].fY && pin[i].fX < pin[min_point].fX))
134 std::vector<Float_t> angles(
N);
135 for (
Int_t i = 0; i <
N; ++i)
137 angles[i] = (pin[i] - pin[min_point]).Phi();
139 std::vector<Int_t> idcs(
N);
146 std::vector<Int_t> new_idcs;
147 new_idcs.push_back(idcs[0]);
148 auto a = idcs.begin(); ++
a;
150 while (
b != idcs.end())
154 if (pin[idcs[0]].SquareDistance(pin[*
a]) < pin[idcs[0]].SquareDistance(pin[*
b]))
159 new_idcs.push_back(*
a);
164 new_idcs.push_back(*
a);
171 std::vector<Int_t> hull;
174 hull.push_back(idcs[0]);
175 hull.push_back(idcs[1]);
176 hull.push_back(idcs[2]);
181 Int_t n = hull.size() - 1;
182 if ((pin[hull[
n]] - pin[hull[
n-1]]).
Cross(pin[idcs[i]] - pin[hull[
n]]) > 0)
184 hull.push_back(idcs[i]);
196 ::Warning(
"REveShape::FindConvexHull()",
"Polygon reduced to %d points. for '%s'.",
197 N, caller ? caller->
GetCName() :
"unknown");
203 Int_t Nold = pout.size();
204 pout.resize(Nold +
N);
205 for (
Int_t i = 0; i <
N; ++i)
207 pout[Nold + i] = pin[hull[i]];
231 return up.
Dot(
f1.Cross(f2)) < 0;
246 return up.
Dot(
f1.Cross(f2)) < 0;
256 std::swap(
box[1],
box[3]);
257 std::swap(
box[5],
box[7]);
268 std::swap(
box[1][0],
box[3][0]);
269 std::swap(
box[1][1],
box[3][1]);
270 std::swap(
box[1][2],
box[3][2]);
271 std::swap(
box[5][0],
box[7][0]);
272 std::swap(
box[5][1],
box[7][1]);
273 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.
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.
~REveShape() override
Destructor.
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)
Sort the n elements of the array a of generic templated type Element.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.