File: nsnappedtwosphere.h

package info (click to toggle)
regina-normal 4.93-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 28,576 kB
  • sloc: cpp: 86,815; ansic: 13,030; xml: 9,089; perl: 951; sh: 380; python: 273; makefile: 103
file content (156 lines) | stat: -rw-r--r-- 5,923 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

/**************************************************************************
 *                                                                        *
 *  Regina - A Normal Surface Theory Calculator                           *
 *  Computational Engine                                                  *
 *                                                                        *
 *  Copyright (c) 1999-2011, Ben Burton                                   *
 *  For further details contact Ben Burton (bab@debian.org).              *
 *                                                                        *
 *  This program is free software; you can redistribute it and/or         *
 *  modify it under the terms of the GNU General Public License as        *
 *  published by the Free Software Foundation; either version 2 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 copy of the GNU General Public             *
 *  License along with this program; if not, write to the Free            *
 *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,       *
 *  MA 02110-1301, USA.                                                   *
 *                                                                        *
 **************************************************************************/

/* end stub */

/*! \file subcomplex/nsnappedtwosphere.h
 *  \brief Deals with 2-spheres made from two snapped 3-balls in a
 *  triangulation.
 */

#ifndef __NSNAPPEDTWOSPHERE_H
#ifndef __DOXYGEN
#define __NSNAPPEDTWOSPHERE_H
#endif

#include "regina-core.h"
#include "subcomplex/nsnappedball.h"

namespace regina {

class NTetrahedron;
class NTriangulation;
class NSnappedBall;

/**
 * \weakgroup subcomplex
 * @{
 */

/**
 * Represents a 2-sphere made from two snapped 3-balls in a triangulation.
 * This occurs when two snapped 3-balls are glued together at their
 * equators (note that this gluing does not have to extend to faces).  Each
 * 3-ball has a central disc (bounded by the 3-ball's equator and bisecting
 * its internal edge), and these two discs together form an embedded
 * 2-sphere in the triangulation.
 *
 * This 2-sphere can be cut along and the two resulting 2-sphere
 * boundaries filled in with 3-balls, and the resulting triangulation has
 * the same number of tetrahedra as the original.  If the snapped
 * 2-sphere was separating, the resulting triangulation will contain the
 * two terms of the corresponding connected sum.
 */
class REGINA_API NSnappedTwoSphere : public ShareableObject {
    private:
        NSnappedBall* ball[2];
            /**< The two snapped 3-balls whose equators are joined. */
    
    public:
        /**
         * Destroys this snapped 2-sphere; note that the corresponding
         * snapped 3-balls will also be destroyed.
         */
        virtual ~NSnappedTwoSphere();
        /**
         * Returns a newly created clone of this structure.
         *
         * @return a newly created clone.
         */
        NSnappedTwoSphere* clone() const;

        /**
         * Returns one of the two snapped 3-balls whose equators are
         * joined.
         *
         * @param index specifies which of the two 3-balls to return;
         * this must be either 0 or 1.
         * @return the corresponding snapped 3-ball.
         */
        const NSnappedBall* getSnappedBall(int index) const;

        /**
         * Determines if the two given tetrahedra together form a snapped
         * 2-sphere.
         *
         * \pre The two given tetrahedra are distinct.
         *
         * @param tet1 the first tetrahedron to examine.
         * @param tet2 the second tetrahedron to examine.
         * @return a newly created structure containing details of the
         * snapped 2-sphere, or \c null if the given tetrahedra do not
         * form a snapped 2-sphere.
         */
        static NSnappedTwoSphere* formsSnappedTwoSphere(NTetrahedron* tet1,
            NTetrahedron* tet2);
        /**
         * Determines if the two given snapped 3-balls together form a snapped
         * 2-sphere.
         *
         * If this is the case, the snapped 3-balls stored in
         * the structure returned will be clones of the
         * original 3-balls, not the original 3-balls themselves.
         *
         * \pre The two given snapped 3-balls use distinct tetrahedra.
         *
         * @param ball1 the first snapped 3-ball to examine.
         * @param ball2 the second snapped 3-ball to examine.
         * @return a newly created structure containing details of the
         * snapped 2-sphere, or \c null if the given snapped 3-balls do not
         * form a snapped 2-sphere.
         */
        static NSnappedTwoSphere* formsSnappedTwoSphere(NSnappedBall* ball1,
            NSnappedBall* ball2);

        void writeTextShort(std::ostream& out) const;

    private:
        /**
         * Creates a new uninitialised structure.
         */
        NSnappedTwoSphere();
};

/*@}*/

// Inline functions for NSnappedTwoSphere

inline NSnappedTwoSphere::NSnappedTwoSphere() {
}
inline NSnappedTwoSphere::~NSnappedTwoSphere() {
    delete ball[0]; delete ball[1];
}
inline const NSnappedBall* NSnappedTwoSphere::getSnappedBall(int index) const {
    return ball[index];
}
inline void NSnappedTwoSphere::writeTextShort(std::ostream& out) const {
    out << "Snapped 2-sphere";
}

} // namespace regina

#endif