1 #include "gearimpl/FixedDiskLayoutBase.h"
27 double phi_min = padCenter[1]-
getPadPitch( padIndex ) /2.;
28 double phi_max = padCenter[1]+
getPadPitch( padIndex ) /2.;
32 if ( (phi >= phi_min) && (phi <= phi_max ) )
35 if( (r >= r_min) && (r <= r_max) )
53 double r_intersect_phiMin = r * (cos(phi)*cos(phi_min) + sin(phi)*sin(phi_min));
54 double m_phiMin = r * (cos(phi)*sin(phi_min) - sin(phi)*cos(phi_min));
56 double distance_phiMin;
57 if ( r_intersect_phiMin < r_min )
61 distance_phiMin = sqrt( r*r + r_min*r_min -2 * r_min * r_intersect_phiMin );
64 if ( r_intersect_phiMin > r_max )
66 distance_phiMin = sqrt( r*r + r_max*r_max -2 * r_max * r_intersect_phiMin );
69 distance_phiMin = fabs( m_phiMin );
73 double r_intersect_phiMax = r * (cos(phi)*cos(phi_max) + sin(phi)*sin(phi_max));
74 double m_phiMax = r * (cos(phi)*sin(phi_max) - sin(phi)*cos(phi_max));
76 double distance_phiMax;
77 if ( r_intersect_phiMax < r_min )
81 distance_phiMax = sqrt( r*r + r_min*r_min -2 * r_min * r_intersect_phiMax );
84 if ( r_intersect_phiMax > r_max )
86 distance_phiMax = sqrt( r*r + r_max*r_max -2 * r_max * r_intersect_phiMax );
89 distance_phiMax = fabs( m_phiMax );
91 return (distance_phiMin < distance_phiMax ? distance_phiMin : distance_phiMax);
virtual double getDistanceToPad(double c0, double c1, int padIndex) const
Returns the closest distance to the edge (outer border) of the pad.
virtual double getRowHeight(int rowNumber) const =0
The row height in mm.
virtual int getPadLayoutType() const
virtual int getCoordinateType() const
The type of the row layouts coordinate system: PadRowLayout2D.POLAR.
virtual double getPadPitch(int padIndex) const =0
The pitch (i.
virtual int getRowNumber(int padIndex) const
The number of the row that contains the pad at padIndex.
virtual Vector2D getPadCenter(int padIndex) const =0
The center of the pad in 2d coordinates, (x,y) or (r,phi).