1 /* Copyright (c) 2015  Gerald Knizia
2  *
3  * This file is part of the IboView program (see: http://www.iboview.org)
4  *
5  * IboView is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, version 3.
8  *
9  * IboView is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with bfint (LICENSE). If not, see http://www.gnu.org/licenses/
16  *
17  * Please see IboView documentation in README.txt for:
18  * -- A list of included external software and their licenses. The included
19  *    external software's copyright is not touched by this agreement.
20  * -- Notes on re-distribution and contributions to/further development of
21  *    the IboView software
22  */
23 
24 #ifndef ISO_SURFACE_H
25 #define ISO_SURFACE_H
26 
27 #include "IvMesh.h"
28 
29 enum FIsoSurfaceFlags {
30    ISOFLAGS_PlusAndMinus = 0x01,
31    ISOFLAGS_AllowFlip = 0x02 // if true, put the larger lobe on the positive side.
32 };
33 
34 enum FIsoType {
35    ISOTYPE_Undefined,
36    ISOTYPE_Absolute,
37    ISOTYPE_Density
38 };
39 
40 struct FIsoSurfaceSettings
41 {
42    // absolute or density based iso values?
43    FIsoType IsoType;
44    // either the absolute iso value c (surfaces are always [c,-c]), or the
45    // density to derive the iso value c from. 0.80 would be 80%.
46    double fIsoValue;
47    // number of points per Angstrom in each direction. surface grid is derived from that.
48    double fLinearDensity;
49 
50    uint Flags;
51    uint32_t dwColorPlus, dwColorMinus;
52 
PlusAndMinusFIsoSurfaceSettings53    bool PlusAndMinus() const { return 0 != (Flags & ISOFLAGS_PlusAndMinus); }
AllowFlipFIsoSurfaceSettings54    bool AllowFlip() const { return PlusAndMinus() && (0 != (Flags & ISOFLAGS_AllowFlip)); }
55 
56    FIsoSurfaceSettings(FIsoType IsoType_ = ISOTYPE_Density, double fIsoValue_ = 0.8,
57 //       double fLinearDensity_ = 20., uint Flags_ = ISOFLAGS_PlusAndMinus | ISOFLAGS_AllowFlip,
58       double fLinearDensity_ = 20., uint Flags_ = ISOFLAGS_PlusAndMinus,
59       uint32_t dwColorPlus_ = 0xffff0000, uint32_t dwColorMinus_ = 0xff0000ff)
IsoTypeFIsoSurfaceSettings60       : IsoType(IsoType_), fIsoValue(fIsoValue_), fLinearDensity(fLinearDensity_), Flags(Flags_),
61         dwColorPlus(dwColorPlus_), dwColorMinus(dwColorMinus_)
62    {};
63 };
64 
65 struct FOrbital;
66 
67 FIndexedTriangleListPtr MakeIsoSurface(FOrbital const *pOrbital, FIsoSurfaceSettings const &Options);
68 
69 #endif // ISO_SURFACE_H
70