[Bf-blender-cvs] [6ae9324ada5] functions: comment on time span
Jacques Lucke
noreply at git.blender.org
Mon Jul 1 17:47:08 CEST 2019
Commit: 6ae9324ada597aeb896ad0daf6ec30bd431c5846
Author: Jacques Lucke
Date: Mon Jul 1 15:40:22 2019 +0200
Branches: functions
https://developer.blender.org/rB6ae9324ada597aeb896ad0daf6ec30bd431c5846
comment on time span
===================================================================
M source/blender/simulations/bparticles/time_span.hpp
===================================================================
diff --git a/source/blender/simulations/bparticles/time_span.hpp b/source/blender/simulations/bparticles/time_span.hpp
index e5c6d90a6d4..14d73ca6739 100644
--- a/source/blender/simulations/bparticles/time_span.hpp
+++ b/source/blender/simulations/bparticles/time_span.hpp
@@ -2,6 +2,10 @@
namespace BParticles {
+/**
+ * Contains a time range defined by a start time and non-zero duration. The times are measured in
+ * seconds.
+ */
struct TimeSpan {
private:
float m_start, m_duration;
@@ -11,26 +15,42 @@ struct TimeSpan {
{
}
+ /**
+ * Get the beginning of the time span.
+ */
float start() const
{
return m_start;
}
+ /**
+ * Get the duration of the time span.
+ */
float duration() const
{
return m_duration;
}
+ /**
+ * Get the end of the time span.
+ */
float end() const
{
return m_start + m_duration;
}
+ /**
+ * Compute a point in time within this time step. Usually 0 <= t <= 1.
+ */
float interpolate(float t) const
{
return m_start + t * m_duration;
}
+ /**
+ * The reverse of interpolate.
+ * Asserts when the duration is 0.
+ */
float get_factor(float time) const
{
BLI_assert(m_duration > 0.0f);
More information about the Bf-blender-cvs
mailing list