KaliVeda
1.12/06
Heavy-Ion Analysis Toolkit
|
Base class for lines/cuts used for particle identification in 2D data maps.
This provides all methods for calculating the shortest distance between a point (x,y) in the map and the line, or for finding the relative orientation of the point and the line (above/below, left/right). These methods are modified versions of methods existing in the TGraph base class.
Note: by default, a KVIDLine cannot be graphically modified using the mouse. This is to avoid accidents! This can of course be changed either with the context menu of the line, or when using the KVIDGridManagerGUI in Edit mode.
Compute the closest distance of approach from point px,py to this line. The units of px, py are the same as the coordinates of the graph. WARNING: can be NEGATIVE - see below.
The distance from the point to each segment is calculated in turn.
If the point lies between the endpoints of at least one segment, the returned distance will be the closest of these segments. In this case i_near gives the index of the first point of the closest segment.
If not then the distance is the smallest distance between the endpoint of a segment and the point. In this case i_near gives the index of the closest endpoint. If the closest segment-endpoint is not one of the endpoints of the whole line, the returned distance is positive. On the other hand, if the closest part of the line to the point is one of the two endpoints of the line, the returned distance is NEGATIVE.
Given a line segment defined by endpoints (xp1,yp1) and (xp2,yp2) find the shortest distance between point (px,py) and the line.
This is simply the magnitude of the component of vector P1->P (or P2->P) perpendicular to P1->P2.
If the point is indeed between the two endpoints as shown, then \(P1M + P2M = P1P2\). If not, \(P1M + P2M > P1P2\). In this case the closest distance is that to the nearer of the two endpoints, but the value returned is negative; i_nearest_point gives the index (0 or 1) of the nearer endpoint
Given a line segment defined by endpoints (xp1,yp1) and (xp2,yp2) test the direction of (px,py) with respect to the line in the (x,y) plane.
This is given by the angle phi between vector MP (component of vector P1->P (or P2->P) perpendicular to P1->P2) and the +ve x-axis.
The option string is "left", "right", "above" or "below", and the result is either kTRUE or kFALSE depending on the relative position of the point and the line. E.g. in the diagram shown above, PosRelToLine("below", ...) would give kTRUE - the point is below the line.
The relative position of point (px,py) with respect to the line is tested. The option string can be "left", "right", "above" or "below". WhereAmI( px, py, "above") returns kTRUE if the point is above the line etc. etc.
First of all, the closest segment/point of the line to the point is found. Then the relative position of the point and this segment/point is tested.
Coordinates of first point in line
Coordinates of last point in line
Returns kTRUE for point (x,y) if :
Definition at line 143 of file KVIDLine.h.
Public Member Functions | |
KVIDLine () | |
Default ctor. More... | |
KVIDLine (const KVIDLine &) | |
copy constructor More... | |
KVIDLine (const TGraph &gr) | |
initialize KVIDLine using TGraph copy ctor More... | |
virtual | ~ KVIDLine () |
Double_t | DistanceToLine (Double_t px, Double_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2, Int_t &) |
Double_t | DistanceToLine (Double_t px, Double_t py, Int_t &) |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
void | GetEndPoint (Double_t &x, Double_t &y) const |
void | GetStartPoint (Double_t &x, Double_t &y) const |
Bool_t | IsBetweenEndPoints (Double_t x, Double_t y, const Char_t *axis="") const |
Bool_t | PosRelToLine (Option_t *opt, Double_t px, Double_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2) |
virtual void | WaitForPrimitive () |
Bool_t | WhereAmI (Double_t px, Double_t py, Option_t *opt) |
![]() | |
KVIDentifier () | |
Default constructor. More... | |
KVIDentifier (const KVIDentifier &) | |
KVIDentifier (const TCutG &) | |
copy a TCutG More... | |
KVIDentifier (const TGraph &) | |
copy a TGraph More... | |
virtual | ~KVIDentifier () |
Destructor. More... | |
virtual Int_t | AddPointAtTheEnd () |
virtual void | ChechHierarchy (KVIDentifier *gr) |
virtual void | CloneScaleStore (Int_t newzt, Int_t newat, Double_t dy=0., Double_t sx=1., Double_t sy=1.) |
Int_t | Compare (const TObject *) const |
virtual Int_t | ContinueDrawing () |
Continue to draw an existing the line. More... | |
void | Copy (TObject &obj) const |
Copy attributes of this identifier into 'obj'. More... | |
void | CopyGraph (const TGraph &) |
Copy coordinates of points from the TGraph. More... | |
void | CopyGraph (TGraph *) |
Copy coordinates of points from the TGraph. More... | |
virtual Int_t | DecreaseNumberOfPoints () |
virtual void | Delete (Option_t *option="") |
virtual void | DrawClass () const |
virtual TObject * | DrawClone (Option_t *option="") const |
virtual void | DrawPanel () |
virtual void | Dump () const |
virtual void | ExtendLine (Double_t, Option_t *Direction="") |
virtual TFitResultPtr | Fit (const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0) |
virtual TFitResultPtr | Fit (TF1 *f1, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0) |
virtual void | FitPanel () |
virtual Int_t | GetA () const |
virtual Int_t | GetID () const |
virtual Int_t | GetMassFormula () const |
KVIDGraph * | GetParent () const |
Get pointer to parent ID graph. More... | |
virtual Double_t | GetPID () const |
virtual Int_t | GetZ () const |
virtual Int_t | IncreaseNumberOfPoints () |
virtual Int_t | InsertPoint () |
Insert a new point at the mouse position. More... | |
virtual Int_t | InsertSmoothPoint () |
Insert a new point at the mouse X position using a smooth evaluation of the Y. More... | |
virtual void | Inspect () const |
virtual Bool_t | OnlyZId () const |
virtual void | Print (Option_t *opt) const |
virtual void | ReadAsciiFile (std::ifstream &) |
virtual Int_t | RemoveFirstPoint () |
virtual Int_t | RemoveLastPoint () |
virtual Int_t | RemovePoint () |
virtual Int_t | RemovePoint (Int_t i) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
virtual void | Scale (Double_t sx=-1, Double_t sy=-1) |
virtual void | Scale (TF1 *sx, TF1 *sy) |
virtual void | SetA (Int_t atnum) |
virtual void | SetAandZ (Int_t atnum, Int_t ztnum) |
virtual void | SetDrawOption (Option_t *option="") |
virtual void | SetFillAttributes () |
virtual void | SetLineAttributes () |
virtual void | SetMarkerAttributes () |
virtual void | SetMassFormula (Int_t mf) |
virtual void | SetMaximum (Double_t maximum=-1111) |
virtual void | SetMinimum (Double_t minimum=-1111) |
virtual void | SetName (const char *name) |
virtual void | SetOnlyZId (Bool_t onlyz=kTRUE) |
void | SetParent (KVIDGraph *) |
Set pointer to parent ID graph. More... | |
virtual void | SetTitle (const char *title="") |
virtual void | SetZ (Int_t ztnum) |
virtual Int_t | SortPoints (Bool_t ascending=kTRUE) |
virtual Bool_t | TestPoint (Double_t, Double_t) |
virtual void | WriteAsciiFile (std::ofstream &, const Char_t *name_prefix="") |
![]() | |
TCutG () | |
TCutG (const char *name, Int_t n, const Double_t *x, const Double_t *y) | |
TCutG (const char *name, Int_t n, const Float_t *x, const Float_t *y) | |
TCutG (const char *name, Int_t n=0) | |
TCutG (const TCutG &cutg) | |
virtual | ~TCutG () |
virtual Double_t | Area () const |
virtual void | Center (Double_t &cx, Double_t &cy) const |
TObject * | GetObjectX () const |
TObject * | GetObjectY () const |
const char * | GetVarX () const |
const char * | GetVarY () const |
virtual Double_t | IntegralHist (TH2 *h, Option_t *option="") const |
TCutG & | operator= (const TCutG &) |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
virtual void | SetObjectX (TObject *obj) |
virtual void | SetObjectY (TObject *obj) |
virtual void | SetVarX (const char *varx) |
virtual void | SetVarY (const char *vary) |
![]() | |
TGraph () | |
TGraph (const char *filename, const char *format="%lg %lg", Option_t *option="") | |
TGraph (const TF1 *f, Option_t *option="") | |
TGraph (const TGraph &gr) | |
TGraph (const TH1 *h) | |
TGraph (const TVectorD &vx, const TVectorD &vy) | |
TGraph (const TVectorF &vx, const TVectorF &vy) | |
TGraph (Int_t n) | |
TGraph (Int_t n, const Double_t *x, const Double_t *y) | |
TGraph (Int_t n, const Float_t *x, const Float_t *y) | |
TGraph (Int_t n, const Int_t *x, const Int_t *y) | |
virtual | ~TGraph () |
virtual void | AddPoint (Double_t x, Double_t y) |
virtual void | Apply (TF1 *f) |
virtual void | Browse (TBrowser *b) |
virtual Double_t | Chisquare (TF1 *f1, Option_t *option="") const |
virtual void | ComputeRange (Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
virtual void | Draw (Option_t *chopt="") |
virtual void | DrawGraph (Int_t n, const Double_t *x=nullptr, const Double_t *y=nullptr, Option_t *option="") |
virtual void | DrawGraph (Int_t n, const Float_t *x, const Float_t *y, Option_t *option="") |
virtual void | DrawGraph (Int_t n, const Int_t *x, const Int_t *y, Option_t *option="") |
virtual Double_t | Eval (Double_t x, TSpline *spline=nullptr, Option_t *option="") const |
virtual void | Expand (Int_t newsize) |
virtual void | Expand (Int_t newsize, Int_t step) |
virtual TObject * | FindObject (const char *name) const |
virtual TObject * | FindObject (const TObject *obj) const |
virtual Double_t | GetCorrelationFactor () const |
virtual Double_t | GetCovariance () const |
Bool_t | GetEditable () const |
virtual Double_t | GetErrorX (Int_t bin) const |
virtual Double_t | GetErrorXhigh (Int_t bin) const |
virtual Double_t | GetErrorXlow (Int_t bin) const |
virtual Double_t | GetErrorY (Int_t bin) const |
virtual Double_t | GetErrorYhigh (Int_t bin) const |
virtual Double_t | GetErrorYlow (Int_t bin) const |
virtual Double_t * | GetEX () const |
virtual Double_t * | GetEXhigh () const |
virtual Double_t * | GetEXhighd () const |
virtual Double_t * | GetEXlow () const |
virtual Double_t * | GetEXlowd () const |
virtual Double_t * | GetEY () const |
virtual Double_t * | GetEYhigh () const |
virtual Double_t * | GetEYhighd () const |
virtual Double_t * | GetEYlow () const |
virtual Double_t * | GetEYlowd () const |
TF1 * | GetFunction (const char *name) const |
TH1F * | GetHistogram () const |
TList * | GetListOfFunctions () const |
Double_t | GetMaximum () const |
Int_t | GetMaxSize () const |
virtual Double_t | GetMean (Int_t axis=1) const |
Double_t | GetMinimum () const |
Int_t | GetN () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
virtual Int_t | GetPoint (Int_t i, Double_t &x, Double_t &y) const |
virtual Double_t | GetPointX (Int_t i) const |
virtual Double_t | GetPointY (Int_t i) const |
virtual Double_t | GetRMS (Int_t axis=1) const |
Double_t * | GetX () const |
TAxis * | GetXaxis () const |
Double_t * | GetY () const |
TAxis * | GetYaxis () const |
virtual void | InitExpo (Double_t xmin=0, Double_t xmax=0) |
virtual void | InitGaus (Double_t xmin=0, Double_t xmax=0) |
virtual void | InitPolynom (Double_t xmin=0, Double_t xmax=0) |
virtual void | InsertPointBefore (Int_t ipoint, Double_t x, Double_t y) |
virtual Double_t | Integral (Int_t first=0, Int_t last=-1) const |
virtual Bool_t | IsEditable () const |
virtual Bool_t | IsHighlight () const |
virtual Int_t | IsInside (Double_t x, Double_t y) const |
virtual void | LeastSquareFit (Int_t m, Double_t *a, Double_t xmin=0, Double_t xmax=0) |
virtual void | LeastSquareLinearFit (Int_t n, Double_t &a0, Double_t &a1, Int_t &ifail, Double_t xmin=0, Double_t xmax=0) |
virtual Int_t | Merge (TCollection *list) |
virtual void | MovePoints (Double_t dx, Double_t dy, Bool_t logx=kFALSE, Bool_t logy=kFALSE) |
TGraph & | operator= (const TGraph &) |
virtual void | Paint (Option_t *chopt="") |
void | PaintGraph (Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt) |
void | PaintGrapHist (Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt) |
virtual void | PaintStats (TF1 *fit) |
virtual void | RecursiveRemove (TObject *obj) |
virtual void | Set (Int_t n) |
virtual void | SetEditable (Bool_t editable=kTRUE) |
virtual void | SetHighlight (Bool_t set=kTRUE) |
virtual void | SetHistogram (TH1F *h) |
virtual void | SetNameTitle (const char *name="", const char *title="") |
virtual void | SetPoint (Int_t i, Double_t x, Double_t y) |
virtual void | SetPointX (Int_t i, Double_t x) |
virtual void | SetPointY (Int_t i, Double_t y) |
virtual void | SetStats (Bool_t stats=kTRUE) |
virtual void | Sort (Bool_t(*greater)(const TGraph *, Int_t, Int_t)=&TGraph::CompareX, Bool_t ascending=kTRUE, Int_t low=0, Int_t high=-1111) |
virtual void | UseCurrentStyle () |
void | Zero (Int_t &k, Double_t AZ, Double_t BZ, Double_t E2, Double_t &X, Double_t &Y, Int_t maxiterations) |
![]() | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
virtual void | Clear (Option_t *option="") |
virtual TObject * | Clone (const char *newname="") const |
virtual void | FillBuffer (char *&buffer) |
virtual const char * | GetName () const |
virtual const char * | GetTitle () const |
virtual ULong_t | Hash () const |
virtual Bool_t | IsSortable () const |
virtual void | ls (Option_t *option="") const |
TNamed & | operator= (const TNamed &rhs) |
virtual Int_t | Sizeof () const |
![]() | |
TObject () | |
TObject (const TObject &object) | |
virtual | ~TObject () |
void | AbstractMethod (const char *method) const |
virtual void | AppendPad (Option_t *option="") |
ULong_t | CheckedHash () |
virtual const char * | ClassName () const |
virtual void | Error (const char *method, const char *msgfmt,...) const |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
virtual Option_t * | GetDrawOption () const |
virtual const char * | GetIconName () const |
virtual Option_t * | GetOption () const |
virtual UInt_t | GetUniqueID () const |
virtual Bool_t | HandleTimer (TTimer *timer) |
Bool_t | HasInconsistentHash () const |
virtual void | Info (const char *method, const char *msgfmt,...) const |
virtual Bool_t | InheritsFrom (const char *classname) const |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
void | InvertBit (UInt_t f) |
virtual Bool_t | IsEqual (const TObject *obj) const |
virtual Bool_t | IsFolder () const |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
virtual Bool_t | Notify () |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
void | operator delete (void *ptr) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
virtual void | Pop () |
virtual Int_t | Read (const char *name) |
void | ResetBit (UInt_t f) |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
virtual void | SetUniqueID (UInt_t uid) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
![]() | |
TAttLine () | |
TAttLine (Color_t lcolor, Style_t lstyle, Width_t lwidth) | |
virtual | ~TAttLine () |
void | Copy (TAttLine &attline) const |
Int_t | DistancetoLine (Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2) |
virtual Color_t | GetLineColor () const |
virtual Style_t | GetLineStyle () const |
virtual Width_t | GetLineWidth () const |
virtual void | Modify () |
virtual void | ResetAttLine (Option_t *option="") |
virtual void | SaveLineAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1) |
virtual void | SetLineColor (Color_t lcolor) |
virtual void | SetLineColorAlpha (Color_t lcolor, Float_t lalpha) |
virtual void | SetLineStyle (Style_t lstyle) |
virtual void | SetLineWidth (Width_t lwidth) |
![]() | |
TAttFill () | |
TAttFill (Color_t fcolor, Style_t fstyle) | |
virtual | ~TAttFill () |
void | Copy (TAttFill &attfill) const |
virtual Color_t | GetFillColor () const |
virtual Style_t | GetFillStyle () const |
virtual Bool_t | IsTransparent () const |
virtual void | Modify () |
virtual void | ResetAttFill (Option_t *option="") |
virtual void | SaveFillAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001) |
virtual void | SetFillColor (Color_t fcolor) |
virtual void | SetFillColorAlpha (Color_t fcolor, Float_t falpha) |
virtual void | SetFillStyle (Style_t fstyle) |
![]() | |
TAttMarker () | |
TAttMarker (Color_t color, Style_t style, Size_t msize) | |
virtual | ~TAttMarker () |
void | Copy (TAttMarker &attmarker) const |
virtual Color_t | GetMarkerColor () const |
virtual Size_t | GetMarkerSize () const |
virtual Style_t | GetMarkerStyle () const |
virtual void | Modify () |
virtual void | ResetAttMarker (Option_t *toption="") |
virtual void | SaveMarkerAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1) |
virtual void | SetMarkerColor (Color_t mcolor=1) |
virtual void | SetMarkerColorAlpha (Color_t mcolor, Float_t malpha) |
virtual void | SetMarkerSize (Size_t msize=1) |
virtual void | SetMarkerStyle (Style_t mstyle=1) |
Static Public Member Functions | |
static KVIDLine * | MakeIDLine (TObject *obj, Double_t xdeb=-1., Double_t xfin=-1., Double_t np=1., Bool_t save=kFALSE) |
![]() | |
static Bool_t | CompareArg (const TGraph *gr, Int_t left, Int_t right) |
static Bool_t | CompareRadius (const TGraph *gr, Int_t left, Int_t right) |
static Bool_t | CompareX (const TGraph *gr, Int_t left, Int_t right) |
static Bool_t | CompareY (const TGraph *gr, Int_t left, Int_t right) |
![]() | |
static Longptr_t | GetDtorOnly () |
static Bool_t | GetObjectStat () |
static void | SetDtorOnly (void *obj) |
static void | SetObjectStat (Bool_t stat) |
![]() | |
static Width_t | GetMarkerLineWidth (Style_t style) |
static Style_t | GetMarkerStyleBase (Style_t style) |
Additional Inherited Members | |
![]() | |
enum | EStatusBits |
![]() | |
enum | EDeprecatedStatusBits |
enum | EStatusBits |
![]() | |
kClipFrame | |
kIsHighlight | |
kIsSortedX | |
kNoStats | |
kNotEditable | |
kResetHisto | |
![]() | |
kBitMask | |
kCanDelete | |
kCannotPick | |
kHasUUID | |
kInconsistent | |
kInvalidObject | |
kIsOnHeap | |
kIsReferenced | |
kMustCleanup | |
kNoContextMenu | |
kNotDeleted | |
kObjInCanvas | |
kOverwrite | |
kSingleKey | |
kWriteDelete | |
kZombie | |
![]() | |
virtual void | ReadAsciiFile_extras (std::ifstream &) |
virtual void | SetNameFromNucleus () |
virtual void | WriteAsciiFile_extras (std::ofstream &, const Char_t *="") |
![]() | |
virtual Double_t ** | Allocate (Int_t newsize) |
Double_t ** | AllocateArrays (Int_t Narrays, Int_t arraySize) |
virtual void | CopyAndRelease (Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) |
virtual Bool_t | CopyPoints (Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) |
Bool_t | CtorAllocate () |
virtual Bool_t | DoMerge (const TGraph *g) |
Double_t ** | ExpandAndCopy (Int_t size, Int_t iend) |
virtual void | FillZero (Int_t begin, Int_t end, Bool_t from_ctor=kTRUE) |
Double_t ** | ShrinkAndCopy (Int_t size, Int_t iend) |
virtual void | SwapPoints (Int_t pos1, Int_t pos2) |
![]() | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
void | MakeZombie () |
![]() | |
static void | SwapValues (Double_t *arr, Int_t pos1, Int_t pos2) |
![]() | |
Int_t | fA |
dummy variables used by context menu dialog boxes More... | |
Bool_t | fGridOnlyZId |
=kTRUE if parent grid has OnlyZId set More... | |
KVNucleus | fIon |
ion/nucleus corresponding to this identifier More... | |
Int_t | fMassFormula |
OPTION={GetMethod="GetMassFormula";SetMethod="SetMassFormula";Items=(0="Beta-stability", 1="VEDA mass", 2="EAL mass", 3="EAL residues", 99="2Z+1")} More... | |
KVIDGraph * | fParent |
parent identification map or grid More... | |
Int_t | fZ |
dummy variables used by context menu dialog boxes More... | |
![]() | |
TObject * | fObjectX |
TObject * | fObjectY |
TString | fVarX |
TString | fVarY |
![]() | |
TList * | fFunctions |
TH1F * | fHistogram |
Double_t | fMaximum |
Int_t | fMaxSize |
Double_t | fMinimum |
Int_t | fNpoints |
Double_t * | fX |
Double_t * | fY |
![]() | |
TString | fName |
TString | fTitle |
![]() | |
kOnlyPrepStep | |
![]() | |
Color_t | fLineColor |
Style_t | fLineStyle |
Width_t | fLineWidth |
![]() | |
Color_t | fFillColor |
Style_t | fFillStyle |
![]() | |
Color_t | fMarkerColor |
Size_t | fMarkerSize |
Style_t | fMarkerStyle |
#include <KVIDLine.h>
KVIDLine::KVIDLine | ( | ) |
Default ctor.
Definition at line 38 of file KVIDLine.cpp.
KVIDLine::KVIDLine | ( | const TGraph & | gr | ) |
initialize KVIDLine using TGraph copy ctor
Definition at line 69 of file KVIDLine.cpp.
KVIDLine::KVIDLine | ( | const KVIDLine & | obj | ) |
copy constructor
Definition at line 58 of file KVIDLine.cpp.
|
virtual |
|
inline |
Given a line segment defined by endpoints (xp1,yp1) and (xp2,yp2) find the shortest distance between point (px,py) and the line.
M P1 (xp1,yp1) x------------------------------------—x P2 (xp2,yp2)
x P (px,py) This is simply the magnitude of the component of vector P1->P (or P2->P) perpendicular to P1->P2.
If the point is indeed between the two endpoints as shown, then P1M + P2M = P1P2 If not, P1M + P2M > P1P2. In this case the closest distance is that to the nearer of the two endpoints, but the value returned is negative; i_nearest_point gives the index (0 or 1) of the nearer endpoint
check point lies between endpoints
cout << "sum = "<<sum<<" P1P2 = " << P1P2.Mod() << " difference = " << sum-P1P2.Mod() << endl;
cout << "take endpoint" << endl;
cout << "point is close to segment" << endl;
Definition at line 242 of file KVIDLine.h.
Compute the closest distance of approach from point px,py to this line. The units of px, py are the same as the coordinates of the graph
WARNING: result can be NEGATIVE - see below.
The distance from the point to each segment is calculated in turn.
If the point lies between the endpoints of at least one segment, the returned distance will be the closest of these segments. In this case i_near gives the index of the first point of the closest segment.
If not then the distance is the smallest distance between the endpoint of a segment and the point. In this case i_near gives the index of the closest endpoint. If the closest segment-endpoint is not one of the endpoints of the whole line, the returned distance is positive. On the other hand, if the closest part of the line to the point is one of the two endpoints of the line, the returned distance is NEGATIVE.
distance = closest approach to a segment with point lying between endpoints dist2 = closest approach to a segment with point outside endpoints if distance == 9999 at end, then dist2 is used
cout << "i=" << i << " X1="<<fX[i]<<" Y1="<<fY[i]<<" X2="<<fX[i+1]<<" Y2="<<fY[i+1]<<" --- d = "<<d<<endl;
point not between endpoints of segment
closest point is an 'internal' point of line - POSITIVE distance
closest point is one of endpoints of line - NEGATIVE distance
Definition at line 178 of file KVIDLine.h.
We override the TGraph::ExecuteEvent which contains a TCutG-specific part making sure that the first and last point are the same. This is a copy of that method with the "if(InheritsFrom("TCutG"))" part commented out.
Execute action corresponding to one event.
This member function is called when a graph is clicked with the locator
If Left button clicked on one of the line end points, this point follows the cursor until button is released.
if Middle button clicked, the line is moved parallel to itself until the button is released.
Reimplemented from TGraph.
Definition at line 226 of file KVIDLine.cpp.
|
inline |
Returns kTRUE for point (x,y) if : axis = "" (default) and both x and y lie inside the endpoints of the line x1 < x < x2, y1 < y < y2 axis = "x" and x lies inside the endpoints x1 < x < x2 axis = "y" and y lies inside the endpoints y1 < y < y2
Definition at line 442 of file KVIDLine.h.
|
static |
create an IDLine from different objects (Inherited from TProfile, TGraph, TF1)
Definition at line 88 of file KVIDLine.cpp.
|
inline |
Given a line segment defined by endpoints (xp1,yp1) and (xp2,yp2) test the direction of (px,py) with respect to the line in the (x,y) plane.
M P1 (xp1,yp1) x------------------------------------—x P2 (xp2,yp2)
x P (px,py) This is given by the angle phi between vector MP (component of vector P1->P (or P2->P) perpendicular to P1->P2) and the +ve x-axis. Point is left of line if 90<phi<270 Point is right of line if 270<phi<90 Point is above line if 0<phi<180 Point is below line if 180<phi<360 The option string is "left", "right", "above" or "below", and the result is either kTRUE or kFALSE depending on the relative position of the point and the line. E.g. in the diagram shown above, PosRelToLine("below", ...) would give kTRUE - the point is below the line.
Point is left of line if 90<phi<270 Point is right of line if 270<phi<90 Point is above line if 0<phi<180 Point is below line if 180<phi<360
Definition at line 293 of file KVIDLine.h.
|
virtual |
Method used to draw a new identifier in the active pad Override in child classes so that gPad->WaitPrimitive has correct arguments
Reimplemented from KVIDentifier.
Definition at line 194 of file KVIDLine.cpp.
The relative position of point (px,py) with respect to the line is tested. The option string can be "left", "right", "above" or "below". WhereAmI( px, py, "above") returns kTRUE if the point is above the line etc. etc.
First of all, the closest segment/point of the line to the point is found. Then the relative position of the point and this segment/point is tested.
Definition at line 348 of file KVIDLine.h.