/** * Creates susbsegments for the segment * * @param cnt the number of subsegments */ private void makeSubsegments(int cnt) { Vector3 dir = getUpperPosition() - getLowerPosition(); for (int i = 1; i < cnt + 1; i++) { float pos = i * length / cnt; // System.err.println("SUBSEG:stem_radius"); float rad = stem.stemRadius(index * length + pos); // System.err.println("SUBSEG: pos: "+ pos+" rad: "+rad+" inx: "+index+" len: "+length); addSubsegment(new CS_SubsegmentImpl(getLowerPosition() + dir * (pos / length), rad, pos, this)); } }
/** * Calcs the base radius of the stem * * @return */ float stemBaseRadius() { if (stemlevel == 0) { // trunk // radius at the base of the stem // I think nScale+-nScaleV should applied to the stem radius but not to base radius(?) return(length * par.Ratio); // * par._0Scale; //+ var(par._0ScaleV)) } else { // max radius is the radius of the parent at offset float max_radius = parent.stemRadius(offset); // FIXME: RatioPower=0 seems not to work here float radius = (float)(parent.baseRadius * Math.Pow(length / parent.length, par.RatioPower)); return(Math.Min(radius, max_radius)); } }