return;
ArrayList<Segment> oldsegments = segments;
segments = new ArrayList<Segment>();
Segment prev = null;
for(Segment segment : oldsegments) {
prev = segment.prev;
Vector3 subsegment = segment.diff.copy().multiply(1F / splits);
BoltPoint[] newpoints = new BoltPoint[splits + 1];
Vector3 startpoint = segment.startpoint.point;
newpoints[0] = segment.startpoint;
newpoints[splits] = segment.endpoint;
for(int i = 1; i < splits; i++) {
Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i));
newpoints[i] = new BoltPoint(basepoint, randoff);
}
for(int i = 0; i < splits; i++) {
Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno);
next.prev = prev;
if (prev != null)
prev.next = next;
if(i != 0 && rand.nextFloat() < splitchance) {
Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength);
numsplits++;
splitparents.put(numsplits, next.splitno);
Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits);
split.prev = prev;
segments.add(split);
}