docs: @Pure
  	@SuppressWarnings("checkstyle:cyclomaticcomplexity")
  	public PT getStartingPointFor(int index) {
  		if ((index < 1) || (this.segmentList.size() <= 1)) {
  			if (this.startingPoint != null) {
  				return this.startingPoint;
  			}
  		} else {
  			int idx = index;
  			ST currentSegment = this.segmentList.get(idx);
  			ST previousSegment = this.segmentList.get(--idx);
  
  			// Because the two segments are the same
  			// we must go deeper in the path elements
  			// to detect the right segment
  			int count = 0;
  			while ((previousSegment != null) && (previousSegment.equals(currentSegment))) {
  				currentSegment = previousSegment;
  				idx--;
  				previousSegment = (idx >= 0) ? this.segmentList.get(idx) : null;
  				count++;
  			}
  
  			if (count > 0) {
  				PT sp = null;
  				if (previousSegment != null) {
  					final PT p1 = currentSegment.getBeginPoint();
  					final PT p2 = currentSegment.getEndPoint();
  					final PT p3 = previousSegment.getBeginPoint();
  					final PT p4 = previousSegment.getEndPoint();
  
  					assert p1 != null && p2 != null && p3 != null && p4 != null;
  					if (p1.equals(p3) || p1.equals(p4)) {
  						sp = p1;
  					} else if (p2.equals(p3) || p2.equals(p4)) {
  						sp = p2;
  					}
  
  				} else {
  					sp = this.startingPoint;
  				}
  				if (sp != null) {
  					return ((count % 2) == 0) ? sp : currentSegment.getOtherSidePoint(sp);
  				}
  
  			} else if ((currentSegment != null) && (previousSegment != null)) {
  				// if the two segments are different
  				// it is simple to detect the
  				// common point
  				final PT p1 = currentSegment.getBeginPoint();
  				final PT p2 = currentSegment.getEndPoint();
  				final PT p3 = previousSegment.getBeginPoint();
  				final PT p4 = previousSegment.getEndPoint();
  
  				assert p1 != null && p2 != null && p3 != null && p4 != null;
  				if (p1.equals(p3) || p1.equals(p4)) {
  					return p1;
  				}
  				if (p2.equals(p3) || p2.equals(p4)) {
  					return p2;
  				}
  			}
  		}
  
  		return null;
  	}