00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: DrawRingsUtils.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.14 $ $Date: 2019/01/17 21:20:59 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * 00019 * Ulities for calculating ring axes, ring puckering and displacement of 00020 * atoms from the mean ring plane. 00021 * 00022 ***************************************************************************/ 00023 00024 #ifndef DRAWRINGUTILS_H 00025 #define DRAWRINGUTILS_H 00026 00027 #include "SmallRing.h" 00028 00029 // Calculate Hill-Reilly pucker sum for a given ring 00030 float hill_reilly_ring_pucker(SmallRing &ring, float *framepos); 00031 00032 // Calculate Hill-Reilly puckering parameters and convert these to a ring colour 00033 void hill_reilly_ring_color(SmallRing &ring, float *framepos, float *rgb); 00034 00035 void hill_reilly_ring_colorscale(SmallRing &ring, float *framepos, float vmin, float vmax, const Scene *scene, float *rgb); 00036 00037 // Calculate Cremer-Pople puckering parameters and convert these to a ring colour 00038 void cremer_pople_ring_color(SmallRing &ring, float *framepos, float *rgb); 00039 00040 // helper functions for Cremer-Pople puckering calculations 00041 void atom_displ_from_mean_plane(float * X, float * Y, float * Z, 00042 float * displ, int N); 00043 00044 int cremer_pople_params(int N_ring_atoms, float * displ, float * q, 00045 float * phi, int & m , float & Q); 00046 00047 // Calculates the position at point t along the spline with co-efficients 00048 // A, B, C and D. 00049 // spline(t) = ((A * t + B) * t + C) * t + D 00050 void ribbon_spline(float *pos, const float * const A, const float * const B, 00051 const float * const C, const float * const D, const float t); 00052 00053 /* 00054 * Ribbon Frame: A frame of reference at a point along a ribbon being drawn by 00055 * using Twister algorithm. 00056 * A frame has an origin and 3 basis vectors, plus and approximate cumulative arc 00057 * length (used for texturing). 00058 */ 00059 struct RibbonFrame { 00060 float forward[3]; 00061 float right[3]; 00062 float up[3]; 00063 float origin[3]; 00064 float arclength; 00065 }; 00066 00067 00068 00069 #endif