// // Freefall motion due to the Gravity on the Earth, on the Moon, and on the Mars. // // Based on the following program // Augmented Reality Dynamic Example by Amnon Owed (21/12/11) // Processing 1.5.1 + NyARToolkit 1.1.6 + GSVideo 1.0 import java.io.*; // for the loadPatternFilenames() function import processing.opengl.*; // for OPENGL rendering import jp.nyatla.nyar4psg.*; // the NyARToolkit Processing library import codeanticode.gsvideo.*; // the GSVideo library String camPara = "D:/My Documents/Processing/libraries/NyAR4psg/data/camera_para.dat"; // カメラのパラメタ? String patternPath = "D:/デスクトップ/開発工作/Processing/patternMaker/examples/ARToolKit_Patterns"; // AR マーカーを学習させたパターンファイルへのパス。 // Preparation for Camera ------------------------------------------------------------------------------------------------------ int arWidth = 640; // カメラから修得する画像のサイズ。カメラに依存する。大きすぎると遅くなる。 int arHeight =360; GSCapture cam; // Preparation for AR --------------------------------------------------------------------------------------------------------- int numMarkers = 10; // 利用する AR マーカーの数 float markersize = 136; int[] inittime = new int[numMarkers]; float[] vx = new float[numMarkers]; // 初速x成分 単位 mm/ms float[] vy = new float[numMarkers]; // 初速y成分 単位 mm/ms float[] gr = new float[numMarkers]; // 重力加速度 単位 mm/ms^2 MKS の 1/1000 MultiMarker nya; void setup() { // Initialization for Camera ------------------------------------------------------------------------------------------------- size(arWidth, arHeight, OPENGL); cam = new GSCapture(this, arWidth, arHeight); cam.start(); // start capturing noStroke(); // turn off stroke for the rest of this sketch :-) // Initialization for AR ------------------------------------------------------------------------------------------------- // create a new MultiMarker at a specific resolution (arWidth x arHeight), with the default camera calibration and coordinate system nya = new MultiMarker(this, arWidth, arHeight, camPara, NyAR4PsgConfig.CONFIG_DEFAULT); // set the delay after which a lost marker is no longer displayed. by default set to something higher, but here manually set to immediate. nya.setLostDelay(1); String[] patterns = loadPatternFilenames(patternPath); // Initialization for Individual Markers ------------------------------------------------------------------------------------- // for the selected number of markers, add the marker for detection // create an individual scale, noiseScale and maximum mountainHeight for that marker (= mountain) for (int i=0; i 3e3 || posy > 3e3 || etime > 3000 ){ inittime[i] = millis(); } } // reset to the default perspective perspective(); } // this function loads .patt filenames into a list of Strings based on a full path to a directory (relies on java.io) String[] loadPatternFilenames(String path) { File folder = new File(path); FilenameFilter pattFilter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".patt"); } }; return folder.list(pattFilter); }