Ejemplo n.º 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;
  }
Ejemplo n.º 2
0
 public static UGeo cylVector(UVertex v1, UVertex v2, float thickness, float extend, int steps) {
   return align(UGeo.cyl(thickness, 100, steps).rotX(HALF_PI), v1, v2, extend);
 }
Ejemplo n.º 3
0
 public static UGeo boxVector(UVertex v1, UVertex v2, float thickness, float extend) {
   return align(UGeo.box(thickness), v1, v2, extend);
 }
Ejemplo n.º 4
0
 public UGeo align(UGeo geo) {
   align(geo.getV());
   return geo;
 }