Loading GUI/src/main/java/cz/fidentis/analyst/scene/HeatmapRenderer.java +22 −7 Original line number Diff line number Diff line Loading @@ -35,15 +35,28 @@ public class HeatmapRenderer { * @param distances Distances in mesh model vertices * @param saturation Saturation of colors at mesh model vertices */ public void drawMeshModel(GL2 gl, MeshModel model, Map<MeshFacet, List<Double>> distances, Map<MeshFacet, List<Double>> saturation) { public void drawMeshModel(GL2 gl, MeshModel model, Map<MeshFacet, List<Double>> distances, Map<MeshFacet, List<Double>> saturation) { double minDistance = Double.POSITIVE_INFINITY; double maxDistance = Double.NEGATIVE_INFINITY; for (MeshFacet f: model.getFacets()) { List<Double> distanceList = distances.get(f); if (distanceList != null) { minDistance = Math.min(minDistance, distanceList.parallelStream().mapToDouble(Double::doubleValue).min().getAsDouble()); maxDistance = Math.max(maxDistance, distanceList.parallelStream().mapToDouble(Double::doubleValue).max().getAsDouble()); minDistance = Math.min( minDistance, distanceList.parallelStream() .mapToDouble(Double::doubleValue) .min() .getAsDouble() ); maxDistance = Math.max( maxDistance, distanceList.parallelStream() .mapToDouble(Double::doubleValue) .max() .getAsDouble() ); } } Loading @@ -63,22 +76,24 @@ public class HeatmapRenderer { * @param minDistance Minimal distance threshold (smaller distances are cut-off) * @param maxDistance Maxim distance threshold (bigger distances are cut-off) */ public void renderMeshFacet(GL2 gl, MeshFacet facet, List<Double> distancesList, List<Double> saturationList, double minDistance, double maxDistance) { public void renderMeshFacet(GL2 gl, MeshFacet facet, List<Double> distancesList, List<Double> saturationList, double minDistance, double maxDistance) { gl.glBegin(GL2.GL_TRIANGLES); //vertices are rendered as triangles // get the normal and tex coords indicies for face i for (int v = 0; v < facet.getCornerTable().getSize(); v++) { int vertexIndex = facet.getCornerTable().getRow(v).getVertexIndex(); // render the normals Vector3d norm = facet.getVertices().get(facet.getCornerTable().getRow(v).getVertexIndex()).getNormal(); Vector3d norm = facet.getVertices().get(vertexIndex).getNormal(); if (norm != null) { gl.glNormal3d(norm.x, norm.y, norm.z); } // render the vertices Point3d vert = facet.getVertices().get(facet.getCornerTable().getRow(v).getVertexIndex()).getPosition(); Point3d vert = facet.getVertices().get(vertexIndex).getPosition(); //get color of vertex int vertexIndex = facet.getCornerTable().getRow(v).getVertexIndex(); double currentDistance = distancesList.get(vertexIndex); double currentSaturation = saturationList == null ? 1d : saturationList.get(vertexIndex); Color c = getColor(currentDistance, currentSaturation, minDistance, maxDistance); Loading Loading
GUI/src/main/java/cz/fidentis/analyst/scene/HeatmapRenderer.java +22 −7 Original line number Diff line number Diff line Loading @@ -35,15 +35,28 @@ public class HeatmapRenderer { * @param distances Distances in mesh model vertices * @param saturation Saturation of colors at mesh model vertices */ public void drawMeshModel(GL2 gl, MeshModel model, Map<MeshFacet, List<Double>> distances, Map<MeshFacet, List<Double>> saturation) { public void drawMeshModel(GL2 gl, MeshModel model, Map<MeshFacet, List<Double>> distances, Map<MeshFacet, List<Double>> saturation) { double minDistance = Double.POSITIVE_INFINITY; double maxDistance = Double.NEGATIVE_INFINITY; for (MeshFacet f: model.getFacets()) { List<Double> distanceList = distances.get(f); if (distanceList != null) { minDistance = Math.min(minDistance, distanceList.parallelStream().mapToDouble(Double::doubleValue).min().getAsDouble()); maxDistance = Math.max(maxDistance, distanceList.parallelStream().mapToDouble(Double::doubleValue).max().getAsDouble()); minDistance = Math.min( minDistance, distanceList.parallelStream() .mapToDouble(Double::doubleValue) .min() .getAsDouble() ); maxDistance = Math.max( maxDistance, distanceList.parallelStream() .mapToDouble(Double::doubleValue) .max() .getAsDouble() ); } } Loading @@ -63,22 +76,24 @@ public class HeatmapRenderer { * @param minDistance Minimal distance threshold (smaller distances are cut-off) * @param maxDistance Maxim distance threshold (bigger distances are cut-off) */ public void renderMeshFacet(GL2 gl, MeshFacet facet, List<Double> distancesList, List<Double> saturationList, double minDistance, double maxDistance) { public void renderMeshFacet(GL2 gl, MeshFacet facet, List<Double> distancesList, List<Double> saturationList, double minDistance, double maxDistance) { gl.glBegin(GL2.GL_TRIANGLES); //vertices are rendered as triangles // get the normal and tex coords indicies for face i for (int v = 0; v < facet.getCornerTable().getSize(); v++) { int vertexIndex = facet.getCornerTable().getRow(v).getVertexIndex(); // render the normals Vector3d norm = facet.getVertices().get(facet.getCornerTable().getRow(v).getVertexIndex()).getNormal(); Vector3d norm = facet.getVertices().get(vertexIndex).getNormal(); if (norm != null) { gl.glNormal3d(norm.x, norm.y, norm.z); } // render the vertices Point3d vert = facet.getVertices().get(facet.getCornerTable().getRow(v).getVertexIndex()).getPosition(); Point3d vert = facet.getVertices().get(vertexIndex).getPosition(); //get color of vertex int vertexIndex = facet.getCornerTable().getRow(v).getVertexIndex(); double currentDistance = distancesList.get(vertexIndex); double currentSaturation = saturationList == null ? 1d : saturationList.get(vertexIndex); Color c = getColor(currentDistance, currentSaturation, minDistance, maxDistance); Loading