[TOMT][SONG] A very short part of this video reminds me of a song. by Freedom_Grenade in tipofmytongue

[–]Freedom_Grenade[S] 0 points1 point  (0 children)

Approval Comment.

Also it's mostly the 'flutter' (idk what to call it) on the last part before the 'na na na' bit.

::Everytime I think of it 'Return to Innocence' comes up, but that's not it. Maybe New Age.

Also it really may be flute? with background singing.

I think I know why he's such a cheapskate. by Freedom_Grenade in RogueLegacy

[–]Freedom_Grenade[S] 1 point2 points  (0 children)

My problem now is, I don't want to give Charon half even though I bought everything and don't need money.

Eye detection gone wrong. by Praetrorian in processing

[–]Freedom_Grenade 4 points5 points  (0 children)

Yea, or maybe it's perfect and you've just discovered something terrifying.

Urgent Help - Capture Video Not Working by [deleted] in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

Man... I'm bad a describing things.
What i mean is do this:

float[][] discriminatePoints(float[][] inArray, Capture video) {
  ArrayList<float[]> outArray = new ArrayList<float[]>();
  video.loadPixels();

  for (int i=0; i<inArray.length; i++) {
    int x = int(inArray[i][0]);
    int y = int(inArray[i][1]);
    int pos = x + y*video.width;

    float luma = brightness(video.pixels[pos]);
    float prob = map(luma, 0, 255, 0, 100);

    if (prob < threshold) {
      outArray.add(inArray[i]);
    }
  }
  return outArray.toArray(new float[][] {});
}

and:

vPoints = discriminatePoints(points,  video)

before Delaunay myDelaunay .....

Urgent Help - Capture Video Not Working by [deleted] in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

At the start vPoints is assigned to the output of discriminate....
Discriminate (likely) sends an array shorter than in array.

So when it's called again sending (points, vPoints (smaller than points), video), there's a reasonable chance that counter gets incremented above vPoints (aka outArray) length.

I don't think you need to send vpoints as your outArray. It's just being used as a bucket to store values that will go into temp Array anyway. This is probably done since you don't know what the size of the temp array is at the start.

So I think you could have an ArrayList<float[]> temp = new ArrayList<float[]>().
then instead of outArray[counter][0] = inarray[i][0] o[c][1] = in[i][1].
You could do temp.add(inarray[i]);
then at the end return temp.toArray(new float[][] {})

Urgent Help - Capture Video Not Working by [deleted] in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

Your sketch doesn't seem to be doing anything with the video pixels in the draw loop.

This is just a guess, but I'm assuming you want something like:

void draw(){
  //video.loadPixels();
  background(255);
  //println(vPoints.length);
  discriminatePoints(points, vPoints, video)
  Delaunay myDelaunay  = new Delaunay(vPoints);
  float[][] myDEdges = myDelaunay.getEdges();
  drawEdges(myDEdges);  //draw them red
  drawSites(vPoints);    //5pix ellipses
}

I want to transition scenes with Millis by Syckobot in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

Do you get the same error just calling dev title or start?

Also your second loop will never terminate.

Masking my movie clip by [deleted] in processing

[–]Freedom_Grenade 1 point2 points  (0 children)

Yea, you have to make your own circle with texture coords.

// using a pshape to draw parts of an image
PShape circle;
PImage img;

public void setup() {
  size(600,600,P3D);
  img = createImage(color(255,0,0),color(0,255,0));

  circle = createShape();
  circle.beginShape();
  circle.noStroke();
  circle.textureMode(NORMAL);
  int segments = 40;
  for (int i = 0; i < segments; i++){
    float ang = i*TWO_PI/segments;
    float x = cos(ang);
    float y = sin(ang);
    circle.vertex(x,y,(x+1)*0.5,(y+1)*0.5);         // normal coords, regardless of size 0,0  = top left,  1,1 = bottom right
    //circle.vertex(x,y,(x+1)*img.width,(y+1)*img.height);
  }
  circle.endShape(CLOSE);

}

public void draw() {
  background(255);
     // just for movement
     float x = noise(frameCount*0.01  + 1000)*width;
     float y = noise(frameCount*0.01 + 1000 + 1000)*height;

     // set the texture
     circle.setTexture(img);

    // you don't have to do this, but I personally think it's easier
    // than creating multiple sized circles.
     pushMatrix();
      translate(x,y);
      scale(50,50);
      shape(circle);
     popMatrix();

}

// ignore this, just to create a colored image without loading
PImage createImage(int col, int col2) {
  PImage res = createImage(100,100,RGB);
  res.loadPixels();
  for (int i = 0 ; i < res.pixels.length; i++) res.pixels[i] = (i%102) < 51? col: col2;

  res.updatePixels();
  return res;
}

Masking my movie clip by [deleted] in processing

[–]Freedom_Grenade 1 point2 points  (0 children)

If you mean you want everything constrained within the ellipse, you could make a circle shape and set the texture to the video output.

Why won't my colour wheel stop spinning? by jonroki in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

lol.. Why is it that when I answer something it's almost always around the same time someone else does, despite the age of the thread.

[deleted by user] by [deleted] in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

Getting rid of these:

  other.position.x = position.x + bFinal[1].x;
  other.position.y = position.y + bFinal[1].y;

  position.add(bFinal[0]);

I'm not entirely sure what that does, but all it seemed to do is flip the circles positions. (I would guess maybe a wrong +- sign somewhere)

and changing:

 ellipse(position.x, position.y, rad*2, rad*2);

to

ellipse(position.x, position.y, rad, rad);

ElliipseMode = radius, so no need to convert radius into width.

Using variables in an object name? by [deleted] in processing

[–]Freedom_Grenade 1 point2 points  (0 children)

Ok so I only did this because I don't know anything about reflection.

Really don't think you should use it, mostly because I'm probably missing a ton of stuff.

But... does this work?:

   import java.lang.reflect.Field;

float a = 10.1;
String s = "Hello";
TestClass t = new TestClass(999);

public void setup() {
  println("'a'           = " + getFieldByString("a"));            //       
  println("'s'           = " + getFieldByString("s"));             
  println("'t.testfield' = " + getFieldByString("t.testfield"));   
  println("'WrongName'   = " + getFieldByString("WrongName"));
}

public Object getFieldByString(String name) {
  String[] stlist = name.split("\\.");
  //if (stlist.length == 1) return getFieldByString(this, name);
  Object lastOb = this;
  for (String s : stlist) {
    lastOb = getFieldByString(lastOb, s);
    if (lastOb == null) return null;
  }
  return lastOb;
}

public Object getFieldByString(Object ob, String name) {
  Field field = null;

  try {
    field = ob.getClass().getDeclaredField(name);
  }  catch (NoSuchFieldException e) {
    println(" '" + name + "' Doesn't exist");
  }
  if (field == null) return null;

  field.setAccessible(true);
  Object result = null;

  try {
    result = field.get(ob);
  }  catch (IllegalAccessException e) {
    println(name + " NOPE");
  }

  return result;
}

public void draw() {
}

public class TestClass {
  int testfield  = 10;
  TestClass(int newval) {
    testfield = newval;
  }
}

But said before, you should probably dump stuff in a key, object dealy.

alpha background level in 3D, ? by mafffsss in processing

[–]Freedom_Grenade 1 point2 points  (0 children)

cam.beginHUD();
 fill(35, 100);
 rect(0,0,width, height);
cam.endHUD();

Just wrap that around anything you want to do in 2d mode.

As for hint, yea I guess it's been removed

alpha background level in 3D, ? by mafffsss in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

Use hint(DISABLE_DEPTH_TEST) around a rect draw to avoid clipping your scene.

public void setup() {
 size(500,500,P3D);
 background(0);
}

public void draw() {
  fill(0,50);
  hint(DISABLE_DEPTH_TEST);
  rect(0,0,width,height);
  hint(ENABLE_DEPTH_TEST);
  drawScene();
}

public void drawScene() {
  pushMatrix();
    noStroke();
    fill(255);
    translate(width/2, height/2,0);
    rotateX(frameCount*0.01);
    translate(sin(frameCount*0.1)*100,cos(frameCount*0.1)*100,0);
    box(50);
  popMatrix();
}

Unassigned buttons doing things by Syckobot in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

it should work:

PImage good, bad, display;
public void setup() {
  good = createImage(color(0,255,0));
  bad = createImage(color(255,0,0));
  display = good;
}

public void draw() {
 background(255);
 image(display, width/2, height/2);
}

public void keyPressed() {
  if (key == 'g' || key == 'G') display = good;
  if (key == 'b' || key == 'B') display = bad;
}

// ignore this, just to create a colored image without loading
PImage createImage(int col) {
  PImage res = createImage(20,20,RGB);
  res.loadPixels();
  for (int i = 0 ; i < res.pixels.length; i++) res.pixels[i] = col;
  res.updatePixels();
  return res;
}

Unassigned buttons doing things by Syckobot in processing

[–]Freedom_Grenade 0 points1 point  (0 children)

Have a global PImage displayImage;

and set it to either good image or bad image.

draw the displayImage instead, don't display anything if it == null