final int contact_height;
+ final int graphHeight;
+
public ContactGeometry(ContactListI contacts, int graphHeight)
{
+ this.graphHeight = graphHeight;
contact_height = contacts.getContactHeight();
// fractional number of contacts covering each pixel
contacts_per_pixel = (graphHeight < 1) ? contact_height
return ci;
}
+ /**
+ * return the cell containing given pixel
+ *
+ * @param pCentre
+ * @return range for pCEntre
+ */
+ public contactInterval mapFor(int pCentre)
+ {
+ int pStart = Math.max(pCentre - pixels_step, 0);
+ int pEnd = Math.min(pStart + pixels_step, graphHeight);
+ int cStart = (int) Math.floor(pStart * contacts_per_pixel);
+ contactInterval ci = new contactInterval(cStart,
+ (int) Math.min(contact_height,
+ Math.ceil(cStart + (pixels_step) * contacts_per_pixel)),
+ pStart, pEnd);
+
+ return ci;
+ }
+
public Iterator<contactInterval> iterateOverContactIntervals(
int graphHeight)
{