/** * @param index * The index of the control point you want the length for. * @return The total approximate length of the segment starting at the given index. */ public double getLength(final int index) { if (null == _lookupTable) { throw new IllegalStateException( "You must generate the look up table before calling this method! see generate()"); } final List<ArcLengthEntry> entries = _lookupTable.get(index); if (null == entries) { throw new IllegalArgumentException("entries was null, the index parameter was invalid. index=" + index); } final ArcLengthEntry arcLength = entries.get(entries.size() - 1); return arcLength.getLength(); }
if (entry.getLength() <= distance) { previous = entry; if (entry.getLength() >= distance) { next = entry; break; final int newIndex = (index + 1 >= _lookupTable.size()) ? 1 : index + 1; delta = getDelta(newIndex, distance - previous.getLength()) + previous.getDelta(); delta = previous.getDelta(); final double d0 = previous.getDelta(); final double d1 = next.getDelta(); final double l0 = previous.getLength(); final double l1 = next.getLength();
entries.add(new ArcLengthEntry(0f, 0)); entries.add(new ArcLengthEntry(t, length));
if (entry.getLength() <= distance) { previous = entry; if (entry.getLength() >= distance) { next = entry; break; final int newIndex = (index + 1 >= _lookupTable.size()) ? 1 : index + 1; delta = getDelta(newIndex, distance - previous.getLength()) + previous.getDelta(); delta = previous.getDelta(); final double d0 = previous.getDelta(); final double d1 = next.getDelta(); final double l0 = previous.getLength(); final double l1 = next.getLength();
entries.add(new ArcLengthEntry(0f, 0)); entries.add(new ArcLengthEntry(t, length));
/** * @param index * The index of the control point you want the length for. * @return The total approximate length of the segment starting at the given index. */ public double getLength(final int index) { if (null == _lookupTable) { throw new IllegalStateException( "You must generate the look up table before calling this method! see generate()"); } final List<ArcLengthEntry> entries = _lookupTable.get(index); if (null == entries) { throw new IllegalArgumentException("entries was null, the index parameter was invalid. index=" + index); } final ArcLengthEntry arcLength = entries.get(entries.size() - 1); return arcLength.getLength(); }