public void setDefaults() { float arra[] = new float[3]; arra[0] = 1; arra[1] = 1; arra[2] = 1; ScaleMirror.setValue(arra); }
public void scaleMirror(float value) { DebugPrinter.println("Mirror::scaleMirror(" + value + ")"); value = scaleFactor - (value / 2); DebugPrinter.println("...value'=" + value); float arra[] = new float[3]; arra[0] = value; arra[1] = 1; arra[2] = 1; ScaleMirror.setValue(arra); }
/** * Output a specific entity to the specified stream. * * @param model The world model to export * @param entityID The entity to export * @param mainScene The X3D scene to write to */ public X3DNode export(WorldModel model, int entityID, X3DScene mainScene, String worldURL) { // get the entity Entity entity = model.getEntity(entityID); if (entity == null) { errorReporter.messageReport("Cannot find model to export: " + entityID); return null; } if (entity.isController()) { return null; } try { X3DNode group; // if the entity has a position then place it if (entity instanceof PositionableEntity) { double[] position = new double[3]; float[] rotation = new float[4]; float[] scale = new float[3]; ((PositionableEntity) entity).getPosition(position); ((PositionableEntity) entity).getRotation(rotation); ((PositionableEntity) entity).getScale(scale); float[] pos = new float[] {(float) position[0], (float) position[1], (float) position[2]}; // create the transform group node group = mainScene.createNode("Transform"); SFVec3f translationField = (SFVec3f) (group.getField("translation")); translationField.setValue(pos); SFRotation rotationField = (SFRotation) (group.getField("rotation")); rotationField.setValue(rotation); SFVec3f scaleField = (SFVec3f) (group.getField("scale")); scaleField.setValue(scale); } else { // create the transform group node group = mainScene.createNode("Group"); } // create the inline node String url = worldURL + entity.getModelURL(); X3DNode inline = mainScene.createNode("Inline"); MFString urlField = (MFString) (inline.getField("url")); urlField.setValue(1, new String[] {url}); // grab the child node to append to MFNode childrenField = (MFNode) (group.getField("children")); // add inline to the group/transform childrenField.append(inline); return group; } catch (Exception ex) { errorReporter.errorReport("Error.", ex); } return null; }
public void shutdown() { // Write final data in .csv // ~800kb/min = ~1100 datasets/min try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); // Prepare Table // "XN_SKEL_HEAD":0, // "XN_SKEL_NECK":1, // "XN_SKEL_TORSO":2, // "XN_SKEL_WAIST":3, // "XN_SKEL_LEFT_COLLAR":4, // "XN_SKEL_LEFT_SHOULDER":5, // "XN_SKEL_LEFT_ELBOW":6, // "XN_SKEL_LEFT_WRIST":7, // "XN_SKEL_LEFT_HAND":8, // "XN_SKEL_LEFT_FINGERTIP":9, // "XN_SKEL_RIGHT_COLLAR":10, // "XN_SKEL_RIGHT_SHOULDER":11, // "XN_SKEL_RIGHT_ELBOW":12, // "XN_SKEL_RIGHT_WRIST":13, // "XN_SKEL_RIGHT_HAND":14, // "XN_SKEL_RIGHT_FINGERTIP":15, // "XN_SKEL_LEFT_HIP":16, // "XN_SKEL_LEFT_KNEE":17, // "XN_SKEL_LEFT_ANKLE":18, // "XN_SKEL_LEFT_FOOT":19, // "XN_SKEL_RIGHT_HIP":20, // "XN_SKEL_RIGHT_KNEE":21, // "XN_SKEL_RIGHT_ANKLE":22, // "XN_SKEL_RIGHT_FOOT":23 int i = 0; for (i = 0; i < 23; i++) { writer.append("joint[" + i + "][x];"); writer.append("joint[" + i + "][y];"); writer.append("joint[" + i + "][z];"); } // Finish Table i++; writer.append("joint[" + i + "][x];"); writer.append("joint[" + i + "][y];"); writer.append("joint[" + i + "][z]"); writer.append("\n"); MFVec3f singleJoint = new MFVec3f(); SFVec3f jointPart = new SFVec3f(); for (i = 0; i < jointList.size(); i++) { int j = 0; singleJoint = jointList.get(i); for (j = 0; j < 23; j++) { singleJoint.get1Value(j, jointPart); writer.append(String.valueOf(jointPart.getX() + ";")); writer.append(String.valueOf(jointPart.getY() + ";")); writer.append(String.valueOf(jointPart.getZ() + ";")); } i++; writer.append(String.valueOf(jointPart.getX() + ";")); writer.append(String.valueOf(jointPart.getY() + ";")); writer.append(String.valueOf(jointPart.getZ() + "\n")); } writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } }