/// <summary> /// Allow change the color of the List lcolor according the height of the lvertex /// </summary> /// <param name="lvertex"> List of vertex to read the height according the min Vertex</param> /// <param name="lcolor"> List of color to change according its height</param> private void changeColorScale(ref List <SharpGL.SceneGraph.Vertex> lvertex, ref List <SharpGL.SceneGraph.Vertex> lcolor) { //top color SharpGL.SceneGraph.GLColor red = new SharpGL.SceneGraph.GLColor(0.9f, 0.05f, 0.05f, 1); //bottom color SharpGL.SceneGraph.GLColor green = new SharpGL.SceneGraph.GLColor(0.05f, 0.95f, 0.05f, 1); float diff = maxVertex.Z - minVertex.Z; SharpGL.SceneGraph.Vertex colorTemp = new SharpGL.SceneGraph.Vertex(); for (int k = 0; k < lcolor.Count; k++) { float t = (l_vertex[k].Z - minVertex.Z) / diff; //interpolated value colorTemp.Set((red.R * (1.0f - t)) + (green.R * t), (red.G * (1.0f - t)) + (green.G * t), (red.B * (1.0f - t)) + (green.B * t)); lcolor[k] = colorTemp; } }
/// <summary> /// Allow change the color of the List lcolor according the height of the lvertex /// </summary> /// <param name="lvertex"> List of vertex to read the height according the min Vertex</param> /// <param name="lcolor"> List of color to change according its height</param> private void changeColorScale(ref List<SharpGL.SceneGraph.Vertex> lvertex, ref List<SharpGL.SceneGraph.Vertex> lcolor) { //top color SharpGL.SceneGraph.GLColor red = new SharpGL.SceneGraph.GLColor(0.9f, 0.05f, 0.05f, 1); //bottom color SharpGL.SceneGraph.GLColor green = new SharpGL.SceneGraph.GLColor(0.05f, 0.95f, 0.05f, 1); float diff = maxVertex.Z - minVertex.Z; SharpGL.SceneGraph.Vertex colorTemp = new SharpGL.SceneGraph.Vertex(); for (int k = 0; k < lcolor.Count; k++) { float t = (l_vertex[k].Z - minVertex.Z) / diff; //interpolated value colorTemp.Set( (red.R * (1.0f - t)) + (green.R * t), (red.G * (1.0f - t)) + (green.G * t), (red.B * (1.0f - t)) + (green.B * t)); lcolor[k] = colorTemp; } }