Package se.llbit.math

Examples of se.llbit.math.Vector4d


    gradientUI.setColor(newColor);
  }

  protected Vector3d getCurrentColor() {
    int index = gradientUI.getSelctedIndex();
    Vector4d stop = gradientUI.getStop(index);
    return new Vector3d(stop.x, stop.y, stop.z);
  }
View Full Code Here


    del.setEnabled(newGradient.size()>2);
  }

  @Override
  public void stopSelected(int index) {
    Vector4d stop = gradientUI.getStop(index);
    updateColorHex(stop.x, stop.y, stop.z);
    posEdit.setText(""+stop.w);
    prev.setEnabled(index > 0);
    next.setEnabled(index < gradientUI.getNumStop()-1);
  }
View Full Code Here

    {
      double angle = Math.asin(ray.d.y);
      int x = 0;
      if (gradient.size() > 1) {
        double pos = (angle+Constants.HALF_PI)/Math.PI;
        Vector4d c0 = gradient.get(x);
        Vector4d c1 = gradient.get(x+1);
        double xx = (pos - c0.w) / (c1.w-c0.w);
        while (x+2 < gradient.size() && xx > 1) {
          x += 1;
          c0 = gradient.get(x);
          c1 = gradient.get(x+1);
View Full Code Here

  }

  public void setGradient(List<Vector4d> newGradient) {
    gradient = new ArrayList<Vector4d>(newGradient.size());
    for (Vector4d stop: newGradient) {
      gradient.add(new Vector4d(stop));
    }
    scene.refresh();
  }
View Full Code Here

  }

  public List<Vector4d> getGradient() {
    List<Vector4d> copy = new ArrayList<Vector4d>(gradient.size());
    for (Vector4d stop: gradient) {
      copy.add(new Vector4d(stop));
    }
    return copy;
  }
View Full Code Here

    for (int i = 0; i < array.getNumElement(); ++i) {
      JsonObject obj = array.getElement(i).object();
      Vector3d color = new Vector3d();
      try {
        Color.fromString(obj.get("rgb").stringValue(""), 16, color);
        Vector4d stop = new Vector4d(color.x, color.y, color.z, obj.get("pos").doubleValue(Double.NaN));
        if (!Double.isNaN(stop.w)) {
          gradient.add(stop);
        }
      } catch (NumberFormatException e) {
      }
    }
    boolean errors = false;
    for (int i = 0; i < gradient.size(); ++i) {
      Vector4d stop = gradient.get(i);
      if (i == 0) {
        if (stop.w != 0) {
          errors = true;
          break;
        }
View Full Code Here

      return gradient;
    }
  }

  public static void makeDefaultGradient(Collection<Vector4d> gradient) {
    gradient.add(new Vector4d(9/255., 183/255., 217/255., 0));
    gradient.add(new Vector4d(212/255., 245/255., 251/255., 1));
  }
View Full Code Here

  public SaturationPicker(final ColorPicker colorPicker) {
    super(colorPicker);
    this.colorPicker = colorPicker;

    gradient.add(new Vector4d(0, 0, 0, 0.00));
    gradient.add(new Vector4d(1, 1, 1, 1.00));
  }
View Full Code Here

  public HuePicker(final ColorPicker colorPicker) {
    super(colorPicker);
    this.colorPicker = colorPicker;

    gradient.add(new Vector4d(1, 0, 0, 0.00));
    gradient.add(new Vector4d(1, 1, 0, 1/6.0));
    gradient.add(new Vector4d(0, 1, 0, 2/6.0));
    gradient.add(new Vector4d(0, 1, 1, 3/6.0));
    gradient.add(new Vector4d(0, 0, 1, 4/6.0));
    gradient.add(new Vector4d(1, 0, 1, 5/6.0));
    gradient.add(new Vector4d(1, 0, 0, 1.00));
  }
View Full Code Here

    }
  }

  protected java.awt.Color getMarkerColor(double pos) {
    int x = 0;
    Vector4d c0 = gradient.get(x);
    Vector4d c1 = gradient.get(x+1);
    double xx = (pos - c0.w) / (c1.w-c0.w);
    while (x+2 < gradient.size() && xx > 1) {
      x += 1;
      c0 = gradient.get(x);
      c1 = gradient.get(x+1);
View Full Code Here

TOP

Related Classes of se.llbit.math.Vector4d

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.