/* * density-contour/density-contour-triangles.cc * * Copyright 2007 by The University of York * Author: Paul Emsley * * This file is part of Coot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copies of the GNU General Public License and * the GNU Lesser General Public License along with this program; if not, * write to the Free Software Foundation, Inc., 51 Franklin Street, * Fifth Floor, Boston, MA, 02110-1301, USA. * See http://www.gnu.org/licenses/ */ #include #include "CIsoSurface.h" void coot::density_contour_triangles_container_t::depth_sort(const clipper::Coord_orth &back_plane_point, const clipper::Coord_orth &front_plane_point) { clipper::Coord_orth back_front = front_plane_point - back_plane_point; double bf_squared = back_front.lengthsq(); if (bf_squared < 0.000001) bf_squared = 0.000001; for (unsigned int i=0; i sum_normals(normals.size()); std::vector n_contribs(normals.size(), 0); clipper::Coord_orth zero(0,0,0); for (unsigned int i=0; i 0) normals[i] = clipper::Coord_orth(sum_normals[i].unit()); else normals[i] = clipper::Coord_orth(0,0,1); } // more validation that I don't want to delete at the moment. if (false) { std::cout << "in calculate_normals() points.size() " << points.size() << std::endl; std::cout << "in calculate_normals() normals.size() " << normals.size() << std::endl; for (unsigned int i=0; i #include "coot-utils/coot-map-utils.hh" // use the function gradient void coot::density_contour_triangles_container_t::calculate_normals_for_vertices(const clipper::Xmap &xmap) { auto tp_0 = std::chrono::high_resolution_clock::now(); float delta = 0.03; for (unsigned int i=0; i(tp_1 - tp_0).count(); if (false) std::cout << "normals_from_function_gradient(): time " << d10 << " ms " << std::endl; }