コード例 #1
0
  private void calcMarkers() {
    SegLine seg = (SegLine) m_seg;
    // draw the axis line
    marker_line.setLine(
        (int) seg.getM_start().getX() - MARKER_LINE_LENGTH,
        (int) seg.getM_start().getY(),
        (int) seg.getM_start().getX() + MARKER_LINE_LENGTH,
        (int) seg.getM_start().getY());

    // draw the 90 deg angle
    if (Math.abs(seg.getM_start().getY() - seg.getM_end().getY()) > MARKER_ANGLE_SIDE_LENGTH) {
      if (seg.getM_start().getY() < seg.getM_end().getY()) {
        marker_rect.setBounds(
            (int) (seg.getM_start().getX() + 0.5),
            (int) (seg.getM_start().getY() + 0.5),
            MARKER_ANGLE_SIDE_LENGTH,
            MARKER_ANGLE_SIDE_LENGTH);
      } else {
        marker_rect.setBounds(
            (int) (seg.getM_start().getX() + 0.5),
            (int) (seg.getM_start().getY() + 0.5) - MARKER_ANGLE_SIDE_LENGTH,
            MARKER_ANGLE_SIDE_LENGTH,
            MARKER_ANGLE_SIDE_LENGTH);
      }
    }
  }
コード例 #2
0
 public boolean isConstraintSolved() {
   this.update();
   SegLine l = (SegLine) m_seg;
   if (Math.abs(l.getM_start().getX() - l.getM_end().getX())
       < constraintsHelper.pointOverlapErrorThreshold) return true;
   constraintsHelper.printConstraintSolvingFailure(
       "PerpendicularIndConstraint.isConstraintSolved",
       "Two Xs are : " + l.getM_start().getX() + " , " + l.getM_end().getX(),
       true);
   return false;
 }