# Generating a hairy circle

My assignment is to generate a hair-like/fur-like texture. For this case, I’m creating a circle of this texture and I would like some advice on how to improve it.

``````PGraphics create_fur_circle(int colour, int radius) {
int x,y,v_x,v_y, v_x_0, v_y_0;
int v_norm=10;
int alpha=200;
float thickness=0.1;
int N_lines=1000;
int l_line=100;
float alpha_max=3.14/3; // Angle between old vector v_0 and new vector v
pg.beginDraw();
pg.stroke(colour, alpha);
pg.strokeWeight(thickness);
for (int i=0; i<N_lines; i+=1) {
// Finding x,y in circle
do {
x = int(random(width));
y = int(random(height));

// Finding v with certain |v|
do {
v_x = int(random(-v_norm,v_norm));
v_y = int(random(-v_norm,v_norm));
} while(dist(0,0,v_x,v_y)>v_norm);

for (int j=0; j<l_line; j+=1) {

// Drawing line
pg.line(x, y, x+v_x, y+v_y);

// Moving x, y
x+=v_x;
y+=v_y;

// Store old vector coordinates
v_x_0=v_x;
v_y_0=v_y;
do {
v_x = int(random(-v_norm,v_norm));
v_y = int(random(-v_norm,v_norm));
// We need two conditions:
// 1- The norm v_x,v_y is not greater than d
// 2- The angle between v_x_0,v_y_0 (preceding vector) and v_x,v_y is not greater than alpha_max
} while(dist(0,0,v_x,v_y)>v_norm && acos((v_x_0*v_x+v_y_0*v_y)/(v_norm*v_norm))>alpha_max);

}
}
pg.endDraw();
return pg;
}
``````

Here is the result:

Thanks.

Hello,

this looks great!

you could go 3D, make a sphere and place hair on the surface on the sphere

especially, on the head, above the ears and eyes, the hairs go upwards

on the side sideways

then the beard to the side and downwards

and make eyes

Warm regards,

Chrisir

I’m only working on 2D textures. Also, I think the texture looks like strands of hair randomly placed on the floor rather than hair on living skin, which is what I’m aiming for.

Hello,

Vary the shades (color) of the hairs.

Reminds me that I am overdue for a haircut.

`:)`

even in 2D

• on the head, above the ears and eyes, the hairs go upwards

• on the side sideways

• then the beard to the side and downwards

• and make eyes

try a brown / black sphere instead of white

Unfortunately this doesn’t help. I need a 2D texture that looks like hair on skin, something like this:

In essence, a hair texture that is suitable to be pasted over a silhouette.