Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mut_bidir.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_BIDIR_MUT_BIDIR_H_)
21 #define __MITSUBA_BIDIR_MUT_BIDIR_H_
22 
23 #include <mitsuba/bidir/mutator.h>
24 
26 
27 /**
28  * \brief Bidirectional mutation strategy
29  *
30  * This class implements a slightly extended version of the bidirectional
31  * mutation proposed by Veach. The main change is that it builds on top of
32  * a two-tailed geometric distribution that is used to sample path
33  * configuration proposals in a more flexible manner.
34  *
35  * \author Wenzel Jakob
36  * \ingroup libbidir
37  */
39 public:
40  /**
41  * \brief Construct a new bidirectional mutator
42  *
43  * \param scene
44  * A pointer to the underlying scene
45  *
46  * \param sampler
47  * A sample generator
48  *
49  * \param pool
50  * A memory pool used to allocate new path vertices and edges
51  *
52  * \param kmin
53  * Minimum number of edges in newly proposed paths. This can
54  * be used to exclude direct illumination.
55  *
56  * \param kmax
57  * Minimum number of edges in newly proposed paths.
58  */
59  BidirectionalMutator(const Scene *scene, Sampler *sampler,
60  MemoryPool &pool, int kmin, int kmax);
61 
62  // =============================================================
63  //! @{ \name Implementation of the Mutator interface
64 
65  EMutationType getType() const;
66  Float suitability(const Path &path) const;
67  bool sampleMutation(Path &source, Path &proposal, MutationRecord &muRec, const MutationRecord& sourceMuRec);
68  Float Q(const Path &source, const Path &proposal,
69  const MutationRecord &muRec) const;
70  void accept(const MutationRecord &muRec);
71 
72  //! @}
73  // =============================================================
74 
76 protected:
77  /**
78  * \brief Compute the probability mass associated with one
79  * of the internally implemented mutation strategies
80  */
81  Float pmfMutation(const Path &source, const MutationRecord &muRec) const;
82 
83  /// Virtual destructor
84  virtual ~BidirectionalMutator();
85 protected:
86  ref<const Scene> m_scene;
87  ref<Sampler> m_sampler;
88  std::vector<int> m_temp;
89  MemoryPool &m_pool;
90  int m_kmin, m_kmax;
91  Path m_tempPath;
92 };
93 
95 
96 #endif /*__MITSUBA_BIDIR_MUT_BIDIR_H_ */
#define MTS_EXPORT_BIDIR
Definition: platform.h:119
Stores supplemental information about an executed mutation strategy.
Definition: mutator.h:115
Bidirectional mutation strategy.
Definition: mut_bidir.h:38
virtual void accept(const MutationRecord &muRec)=0
Record an accepted mutation.
Generic interface to path-space mutators.
Definition: mutator.h:33
Principal scene data structure.
Definition: scene.h:49
Base class of all sample generators.
Definition: sampler.h:66
Bidirectional path data structure.
Definition: path.h:46
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
virtual Float Q(const Path &source, const Path &proposal, const MutationRecord &muRec) const =0
For a pair of paths, this function computes the inverse transition probability (matching the Q term i...
virtual bool sampleMutation(Path &source, Path &proposal, MutationRecord &muRec, const MutationRecord &sourceMuRec)=0
Given a path, this function produces a new proposal according to the internally implemented mutation ...
virtual EMutationType getType() const =0
What kind of mutations does this mutator perform?
EMutationType
Specifies the type of mutation implemented by the mutator.
Definition: mutator.h:36
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Reference counting helper.
Definition: ref.h:40
virtual Float suitability(const Path &path) const =0
Determine the general &quot;suitability&quot; of this mutator for a given kind of path.
Definition: mempool.h:29
#define MTS_NAMESPACE_END
Definition: platform.h:138