use of artisynth.core.util.ObjectToken in project artisynth_core by artisynth.
the class PointFem3dAttachment method scanNodes.
protected static void scanNodes(ReaderTokenizer rtok, Deque<ScanToken> tokens) throws IOException {
ArrayList<Double> coordList = new ArrayList<Double>();
rtok.scanToken('[');
// begin token
tokens.offer(ScanToken.BEGIN);
while (ScanWriteUtils.scanAndStoreReference(rtok, tokens)) {
coordList.add(rtok.scanNumber());
}
if (rtok.ttype != ']') {
throw new IOException("Expected ']', got " + rtok);
}
// terminator token
tokens.offer(ScanToken.END);
tokens.offer(new ObjectToken(ArraySupport.toDoubleArray(coordList)));
}
use of artisynth.core.util.ObjectToken in project artisynth_core by artisynth.
the class MFreeMeshComp method scanAttachment.
protected void scanAttachment(ReaderTokenizer rtok, Deque<ScanToken> tokens) throws IOException {
ArrayList<Double> weights = new ArrayList<Double>();
rtok.scanToken('[');
tokens.offer(ScanToken.BEGIN);
while (ScanWriteUtils.scanAndStoreReference(rtok, tokens)) {
weights.add(rtok.scanNumber());
}
if (rtok.ttype != ']') {
throw new IOException("Expected ']', got " + rtok);
}
// while (rtok.nextToken() != ']') {
// rtok.pushBack();
// ScanWriteUtils.scanReferenceToken (rtok, tokens);
// weights.add (rtok.scanNumber());
// }
// add null terminator
tokens.offer(ScanToken.END);
if (weights.size() == 1) {
PointParticleAttachment ppa = new PointParticleAttachment();
myVertexAttachments.add(ppa);
} else {
PointFem3dAttachment pfa = new PointFem3dAttachment();
tokens.offer(new ObjectToken(ArraySupport.toDoubleArray(weights)));
myVertexAttachments.add(pfa);
}
}
use of artisynth.core.util.ObjectToken in project artisynth_core by artisynth.
the class FemMeshComp method scanAttachment.
protected void scanAttachment(ReaderTokenizer rtok, Deque<ScanToken> tokens) throws IOException {
ArrayList<Double> weights = new ArrayList<Double>();
rtok.scanToken('[');
tokens.offer(ScanToken.BEGIN);
while (ScanWriteUtils.scanAndStoreReference(rtok, tokens)) {
weights.add(rtok.scanNumber());
}
if (rtok.ttype != ']') {
throw new IOException("Expected ']', got " + rtok);
}
// while (rtok.nextToken() != ']') {
// rtok.pushBack();
// ScanWriteUtils.scanReferenceToken (rtok, tokens);
// weights.add (rtok.scanNumber());
// }
// add null terminator
tokens.offer(ScanToken.END);
if (weights.size() == 1) {
PointParticleAttachment ppa = new PointParticleAttachment();
myVertexAttachments.add(ppa);
} else {
PointFem3dAttachment pfa = new PointFem3dAttachment();
tokens.offer(new ObjectToken(ArraySupport.toDoubleArray(weights)));
myVertexAttachments.add(pfa);
}
}
Aggregations