#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# How to draw a point between

edited May 2014 in Kinect

i try to draw a point between the knees of the skeleton.

## Answers

• I think you need to show some code, it is hard to say. Maybe this is helpful, it is a way to draw a point between two points in general (assuming you are using PVectors):

``````PVector a, b;

void setup() {
size(400, 400);
noFill();
newPoints();
}

void draw() {
background(255);

ellipse(a.x, a.y, 10, 10);
ellipse(b.x, b.y, 10, 10);
line(a.x, a.y, b.x, b.y);

PVector c = new PVector((a.x+b.x)/2, (a.y+b.y)/2);
ellipse(c.x, c.y, 15, 15);
}

void mousePressed() {
newPoints();
}

void newPoints() {
a = new PVector(random(width), random(height));
b = new PVector(random(width), random(height));
}
``````
• edited May 2014

A remix version from @asimes which uses method set() rather than instantiating `new` PVector objects all the time: O:-)

``````// forum.processing.org/two/discussion/5381/how-to-draw-a-point-between

static final int SMALLER = 10, BIGGER = 15;
static final color BG = -1;

final PVector a = new PVector(), b  = new PVector(), c = new PVector();

void setup() {
size(600, 400, JAVA2D);
frameRate(10);
noLoop();
smooth(4);
ellipseMode(CENTER);

noFill();
strokeWeight(2);
}

void draw() {
background(BG);
stroke((color) random(#000000));

a.set(random(width), random(height));
b.set(random(width), random(height));
PVector.add(a, b, c).div(2);

line(a.x, a.y, b.x, b.y);

ellipse(a.x, a.y, SMALLER, SMALLER);
ellipse(b.x, b.y, SMALLER, SMALLER);

ellipse(c.x, c.y, BIGGER, BIGGER);
}

void mousePressed() {
redraw();
}

void keyPressed() {
redraw();
}
``````
Sign In or Register to comment.