The following code(the most important part) can achieve the programming effect I want

```
// params.count ： Number of points
// params.branch : Number of lines
// params.radius : The radius of the shape
const generateGalaxy = () => {
geometry = new THREE.BufferGeometry();
const positions = new Float32Array(params.count * 3);
const colors = new Float32Array(params.count * 3);
for (let i = 0; i < params.count; i++) {
const branchAngel = (i % params.branch) * ((2 * Math.PI) / params.branch);
const distance = Math.random() * params.radius;
const current = i * 3;
// Calculate coordinates
positions[current] = Math.cos(branchAngel + distance) * distance;
positions[current + 1] = 0;
positions[current + 2] = Math.sin(branchAngel + distance) * distance;
}
```

Running result：

My question is why distance needs to be added after branchAngel in trigonometric functions to achieve bending effect when calculating coordinates

When there is only branchAngel in the function, the line drawn is a straight line

Like this

```
positions[current] = Math.cos(branchAngel) * distance;
positions[current + 1] = 0;
positions[current + 2] = Math.sin(branchAngel) * distance;
```

When I add a constant,the result is still a straight line

Like this

```
positions[current] = Math.cos(branchAngel + 3) * distance;
positions[current + 1] = 0;
positions[current + 2] = Math.sin(branchAngel + 3) * distance;
```

When I add a random variable

```
const r = Math.random() * 8;
positions[current] = Math.cos(branchAngel + r) * distance;
positions[current + 1] = 0;
positions[current + 2] = Math.sin(branchAngel + r) * distance;
```

The result

I looked up a rotation matrix in advanced algebra, but I haven’t figured out the relationship between this formula and the addition of distance after branchAngel when calculating coordinates here.

So, in order to generate a curve, do we need to add a number related to distance after branchAngel? Why?

Looking forward to everyone’s reply