Java Code Examples for processing.core.PMatrix3D#set()
The following examples show how to use
processing.core.PMatrix3D#set() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkerBoardJavaCV.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
private void update(PMatrix3D newPos, int id) { PMatrix3D transfo = (PMatrix3D) transfos.get(id); fr.inria.papart.multitouch.OneEuroFilter filter[] = filters.get(id); if (filter == null) { transfo.set(newPos); } else { try { // Rotation transfo.m00 = (float) filter[0].filter(newPos.m00); transfo.m01 = (float) filter[1].filter(newPos.m01); transfo.m02 = (float) filter[2].filter(newPos.m02); transfo.m10 = (float) filter[3].filter(newPos.m10); transfo.m11 = (float) filter[4].filter(newPos.m11); transfo.m12 = (float) filter[5].filter(newPos.m12); transfo.m20 = (float) filter[6].filter(newPos.m20); transfo.m21 = (float) filter[7].filter(newPos.m21); transfo.m22 = (float) filter[8].filter(newPos.m22); // Translation transfo.m03 = (float) filter[9].filter(newPos.m03); transfo.m13 = (float) filter[10].filter(newPos.m13); transfo.m23 = (float) filter[11].filter(newPos.m23); } catch (Exception e) { System.out.println("Filtering error " + e); } } // // // If z negation hack required... // PMatrix3D tmp = new PMatrix3D(transfo[0], transfo[1], transfo[2], transfo[3], // transfo[4], transfo[5], transfo[6], transfo[7], // transfo[8], transfo[9], transfo[10], transfo[11], // 0, 0, 0, 1); //// tmp.print(); // tmp.scale(1, 1, -1); // transfo[11] = -transfo[11]; }
Example 2
Source File: MarkerBoardSvg.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
private void update(PMatrix3D newPos, int id) { PMatrix3D transfo = (PMatrix3D) transfos.get(id); fr.inria.papart.multitouch.OneEuroFilter filter[] = filters.get(id); if (filter == null) { transfo.set(newPos); } else { try { // Rotation transfo.m00 = (float) filter[0].filter(newPos.m00); transfo.m01 = (float) filter[1].filter(newPos.m01); transfo.m02 = (float) filter[2].filter(newPos.m02); transfo.m10 = (float) filter[3].filter(newPos.m10); transfo.m11 = (float) filter[4].filter(newPos.m11); transfo.m12 = (float) filter[5].filter(newPos.m12); transfo.m20 = (float) filter[6].filter(newPos.m20); transfo.m21 = (float) filter[7].filter(newPos.m21); transfo.m22 = (float) filter[8].filter(newPos.m22); // Translation transfo.m03 = (float) filter[9].filter(newPos.m03); transfo.m13 = (float) filter[10].filter(newPos.m13); transfo.m23 = (float) filter[11].filter(newPos.m23); } catch (Exception e) { System.out.println("Filtering error " + e); } } // float pageHeight = this.height; float pageHeight = markersFromSVG.getSheetHeight(); // Invert the scales so that it fits Inkscape's view. transfo.scale(1, -1, 1); transfo.translate(0, -pageHeight, 0); }
Example 3
Source File: HomographyCalibrationTest.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
public static PMatrix3D createDummyValues() { float[] dummyValues = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; PMatrix3D mat = new PMatrix3D(); mat.set(dummyValues); return mat; }
Example 4
Source File: ProjectiveCalibrationTest.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
public static PMatrix3D createDummyValues() { float[] dummyValues = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; PMatrix3D mat = new PMatrix3D(); mat.set(dummyValues); return mat; }
Example 5
Source File: MarkerBoardARToolKitPlus.java From PapARt with GNU Lesser General Public License v3.0 | 4 votes |
private void update(ARToolKitPlus.ARMultiMarkerInfoT multiMarkerConfig, int id) { fr.inria.papart.multitouch.OneEuroFilter filter[] = filters.get(id); PMatrix3D inputMatrix = new PMatrix3D(); if (filter == null) { inputMatrix.m00 = multiMarkerConfig.trans().get(0); inputMatrix.m01 = multiMarkerConfig.trans().get(1); inputMatrix.m02 = multiMarkerConfig.trans().get(2); inputMatrix.m03 = multiMarkerConfig.trans().get(3); inputMatrix.m10 = multiMarkerConfig.trans().get(4); inputMatrix.m11 = multiMarkerConfig.trans().get(5); inputMatrix.m12 = multiMarkerConfig.trans().get(6); inputMatrix.m13 = multiMarkerConfig.trans().get(7); inputMatrix.m20 = multiMarkerConfig.trans().get(8); inputMatrix.m21 = multiMarkerConfig.trans().get(9); inputMatrix.m22 = multiMarkerConfig.trans().get(10); inputMatrix.m23 = multiMarkerConfig.trans().get(11); } else { try { inputMatrix.m00 = (float) filter[0].filter(multiMarkerConfig.trans().get(0)); inputMatrix.m01 = (float) filter[1].filter(multiMarkerConfig.trans().get(1)); inputMatrix.m02 = (float) filter[2].filter(multiMarkerConfig.trans().get(2)); inputMatrix.m03 = (float) filter[3].filter(multiMarkerConfig.trans().get(3)); inputMatrix.m10 = (float) filter[4].filter(multiMarkerConfig.trans().get(4)); inputMatrix.m11 = (float) filter[5].filter(multiMarkerConfig.trans().get(5)); inputMatrix.m12 = (float) filter[6].filter(multiMarkerConfig.trans().get(6)); inputMatrix.m13 = (float) filter[7].filter(multiMarkerConfig.trans().get(7)); inputMatrix.m20 = (float) filter[8].filter(multiMarkerConfig.trans().get(8)); inputMatrix.m21 = (float) filter[9].filter(multiMarkerConfig.trans().get(9)); inputMatrix.m22 = (float) filter[10].filter(multiMarkerConfig.trans().get(10)); inputMatrix.m23 = (float) filter[11].filter(multiMarkerConfig.trans().get(11)); } catch (Exception e) { System.out.println("Filtering error " + e); } } // inputMatrix.translate(0, height / 2, 0); // inputMatrix.scale(1, -1, 1); // inputMatrix.translate(0, -height / 2, 0); // Invert the scales so that it fits Inkscape's view. inputMatrix.scale(1, -1, 1); inputMatrix.translate(0, -markerBoardSize.y, 0); PMatrix3D transfo = transfos.get(id); transfo.set(inputMatrix); // Z negation ? // tmp.scale(1, 1, -1); // transfo[11] = -transfo[11]; }
Example 6
Source File: MarkerBoard.java From PapARt with GNU Lesser General Public License v3.0 | 4 votes |
public void setFakeLocation(Camera camera, PMatrix3D location) { int id = getId(camera); PMatrix3D transfo = (PMatrix3D) transfos.get(id); transfo.set(location); }