Exemplo n.º 1
0
 private static int toColour(RealVector ambient) {
   final double r = ambient.getEntry(0);
   final double g = ambient.getEntry(1);
   final double b = ambient.getEntry(2);
   int rc = 256 * 256 * (int) (255. * r);
   int rg = 256 * (int) (255. * g);
   int rb = (int) (255. * b);
   return rc + rg + rb;
 }
Exemplo n.º 2
0
 private static Intersection getIntersection(
     TriangleObject obj, DecompositionSolver solver, Vector3D p, Vector3D pc, double[] params) {
   RealVector constants = new ArrayRealVector(params, false);
   RealVector solution = solver.solve(constants);
   double alpfa = solution.getEntry(0);
   double beta = solution.getEntry(1);
   boolean match = false;
   if (alpfa >= 0 && beta >= 0 && alpfa + beta <= 1.0) {
     match = true;
   } else {
     match = false;
   }
   final Intersection intersection = new Intersection(match);
   intersection.setObject(obj);
   intersection.setP(p);
   return intersection;
 }