Beispiel #1
0
  /**
   * Aligns and scales a UGeo instance so that the result geometry lies along the vector given by
   * the input vertices. <code>geo</code> is assumed to be facing "forward" along the positive Z
   * axis and will be scaled along that axis to match the length of the input vector, leaving the X
   * and Y dimensions unchanged.
   *
   * @param geo
   * @param v1
   * @param v2
   * @return
   */
  public static UGeo align(UGeo geo, UVertex v1, UVertex v2, float extend) {
    UVertex dir = v2.copy().sub(v1);
    UHeading h = new UHeading(dir);

    //    UMB.log(dir.mag()+" "+geo.dimZ());
    float m = dir.mag();
    if (extend > 0) m += extend * 2;

    geo.center().scale(1, 1, m / geo.dimZ());

    h.align(geo.getV());
    geo.translate(dir.mult(0.5f).add(v1));
    return geo;
  }
Beispiel #2
0
 public UGeo align(UGeo geo) {
   align(geo.getV());
   return geo;
 }