Example #1
0
        public void TestCompose()
        {
            ContinuousMap <int, int> c = ((ContinuousMap <int, int>)TimesTwo).Compose((int x) => x + 1);

            Assert.NotNull(c);
            Assert.Equal(16, c.GetValueAt(7));
        }
Example #2
0
 /// <summary>
 ///     Construct a pie-slice of a new <c>Cylinder</c> around a central axis, the <c>centerLine</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
 ///     The cylinder is cut in a pie-slice along the length of the shaft, defined by the angles
 ///     <c>startAngle</c> and <c>endAngle</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$t \in [0, 1]\f$ (along the length of the shaft) and
 ///     \f$\phi \in [0, 2 \pi]\f$ (along the radial coordinate).
 ///
 ///     This gives a pie-sliced cylindrical surface that is defined only between the angles <c>startAngle</c>
 ///     and <c>endAngle</c>. For example, if <c>startAngle = 0.0f</c> and <c>endAngle = Math.PI</c>, one would
 ///     get a cylinder that is sliced in half.
 /// </summary>
 /// <param name="centerCurve">
 ///     <inheritdoc cref="SymmetricCylinder.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="SymmetricCylinder.Radius"/>
 /// </param>
 public Cylinder(Curve centerCurve, ContinuousMap <dvec2, double> radius)
 {
     this.CenterCurve = centerCurve;
     this.Radius      = radius;
     this.StartAngle  = 0.0;
     this.EndAngle    = 2.0 * (double)Math.PI;
 }
Example #3
0
 /// <summary>
 ///     Construct a pie-slice of a new <c>Cylinder</c> around a central axis, the <c>centerLine</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
 ///     The cylinder is cut in a pie-slice along the length of the shaft, defined by the angles
 ///     <c>startAngle</c> and <c>endAngle</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$t \in [0, 1]\f$ (along the length of the shaft) and
 ///     \f$\phi \in [0, 2 \pi]\f$ (along the radial coordinate).
 ///
 ///     This gives a pie-sliced cylindrical surface that is defined only between the angles <c>startAngle</c>
 ///     and <c>endAngle</c>. For example, if <c>startAngle = 0.0f</c> and <c>endAngle = Math.PI</c>, one would
 ///     get a cylinder that is sliced in half.
 /// </summary>
 /// <param name="centerLine">
 ///     <inheritdoc cref="SymmetricCylinder.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="SymmetricCylinder.Radius"/>
 /// </param>
 public Cylinder(Curve centerCurve, ContinuousMap <Vector2, float> radius)
 {
     this.CenterCurve = centerCurve;
     this.Radius      = radius;
     this.StartAngle  = 0.0f;
     this.EndAngle    = 2.0f * (float)Math.PI;
 }
Example #4
0
 /// <summary>
 ///     Construct a pie-slice of a new <c>Cylinder</c> around a central axis, the <c>centerLine</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
 ///     The cylinder is cut in a pie-slice along the length of the shaft, defined by the angles
 ///     <c>startAngle</c> and <c>endAngle</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$t \in [0, 1]\f$ (along the length of the shaft) and
 ///     \f$\phi \in [0, 2 \pi]\f$ (along the radial coordinate).
 ///
 ///     This gives a pie-sliced cylindrical surface that is defined only between the angles <c>startAngle</c>
 ///     and <c>endAngle</c>. For example, if <c>startAngle = 0.0f</c> and <c>endAngle = Math.PI</c>, one would
 ///     get a cylinder that is sliced in half.
 /// </summary>
 /// <param name="centerLine">
 ///     <inheritdoc cref="Cylinder.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="Cylinder.Radius"/>
 /// </param>
 /// <param name="startAngle">
 ///     The starting angle of the pie-slice at each point on the central axis. <c>startAngle</c> is a
 ///     one-dimensional function \f$\alpha(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 /// <param name="endAngle">
 ///     The end angle of the pie-slice at each point on the central axis. <c>endAngle</c> is a
 ///     one-dimensional function \f$\beta(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 public Cylinder(Curve centerCurve, ContinuousMap <Vector2, float> radius, ContinuousMap <float, float> startAngle, ContinuousMap <float, float> endAngle)
 {
     this.CenterCurve = centerCurve;
     this.Radius      = radius;
     this.StartAngle  = startAngle;
     this.EndAngle    = endAngle;
 }
Example #5
0
 /// <summary>
 ///     Construct a pie-slice of a new <c>Cylinder</c> around a central axis, the <c>centerLine</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
 ///     The cylinder is cut in a pie-slice along the length of the shaft, defined by the angles
 ///     <c>startAngle</c> and <c>endAngle</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$t \in [0, 1]\f$ (along the length of the shaft) and
 ///     \f$\phi \in [0, 2 \pi]\f$ (along the radial coordinate).
 ///
 ///     This gives a pie-sliced cylindrical surface that is defined only between the angles <c>startAngle</c>
 ///     and <c>endAngle</c>. For example, if <c>startAngle = 0.0f</c> and <c>endAngle = Math.PI</c>, one would
 ///     get a cylinder that is sliced in half.
 /// </summary>
 /// <param name="centerCurve">
 ///     <inheritdoc cref="Cylinder.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="Cylinder.Radius"/>
 /// </param>
 /// <param name="startAngle">
 ///     The starting angle of the pie-slice at each point on the central axis. <c>startAngle</c> is a
 ///     one-dimensional function \f$\alpha(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 /// <param name="endAngle">
 ///     The end angle of the pie-slice at each point on the central axis. <c>endAngle</c> is a
 ///     one-dimensional function \f$\beta(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 public Cylinder(Curve centerCurve, ContinuousMap <dvec2, double> radius, ContinuousMap <double, double> startAngle, ContinuousMap <double, double> endAngle)
 {
     this.CenterCurve = centerCurve;
     this.Radius      = radius;
     this.StartAngle  = startAngle;
     this.EndAngle    = endAngle;
 }
Example #6
0
        public void TestCasts()
        {
            // C# can't go straight from the function to a ContinuousMap, because technically it's already a cast to
            // become a Func (or any delegate type), double implicit casts are not considered when looking for
            // conversion operators, and there's no way to specify "method set" as the source for an implicit cast.
            // Oh well. Still, if we explicitly cast to Func, our conversion works:
            ContinuousMap <int, int> c = (Func <int, int>)TimesTwo;

            Assert.NotNull(c);
            Assert.Equal(10, c.GetValueAt(5));
            Assert.IsAssignableFrom <FunctionBackedContinuousMap <int, int> >(c);
            Assert.Equal(4, ((FunctionBackedContinuousMap <int, int>)c).F(2));

            FunctionBackedContinuousMap <int, int> d = (Func <int, int>)TimesTwo;

            Assert.NotNull(d);
            Assert.Equal(10, d.GetValueAt(5));
            Assert.Equal(4, d.F(2));
            Assert.IsAssignableFrom <ContinuousMap <int, int> >(d);

            var e = (ContinuousMap <int, int>)TimesTwo;

            Assert.NotNull(e);
            Assert.Equal(10, e.GetValueAt(5));
            Assert.IsAssignableFrom <FunctionBackedContinuousMap <int, int> >(e);
            Assert.Equal(4, ((FunctionBackedContinuousMap <int, int>)e).F(2));
        }
Example #7
0
        public void TestThen()
        {
            ContinuousMap <int, int> c = ((ContinuousMap <int, int>)TimesTwo).Then(x => (x + 1));

            Assert.NotNull(c);
            Assert.Equal(expected: 15, actual: c.GetValueAt(7));
        }
Example #8
0
 /// <summary>
 ///     Construct a new <c>Hemisphere</c> at the point <c>center</c>, pointing in the direction of
 ///     <c>direction</c>. The radius is defined by a two-dimensional function <c>radius</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$u \in [0, 2\pi]\f$ (the azimuthal angle) and
 ///     \f$v \in [0, \frac{1}{2} \pi]\f$ (the inclination angle).
 /// </summary>
 /// <param name="center">
 ///     The position of the hemisphere.
 /// </param>
 /// <param name="direction">
 ///     The vector that defines which way is 'forward' for the object. Will be normalized on initialization.
 /// </param>
 /// <param name="normal">
 ///     The vector that defines which way is 'up' for the object. Should be perpendicular to
 ///     <c>direction</c> and <c>binormal</c>. Will be normalized on initialization.
 /// </param>
 /// <param name="binormal">
 ///     The vector that defines which way is 'left' for the object. Should be perpendicular to
 ///     <c>direction</c> and <c>normal</c>. Will be normalized on initialization.
 /// </param>
 public Hemisphere(ContinuousMap <Vector2, float> radius, Vector3 center, Vector3 direction, Vector3 normal, Vector3 binormal)
 {
     this.Radius    = radius;
     this.Center    = center;
     this.Direction = direction;
     this.Normal    = normal;
     this.Binormal  = binormal;
 }
Example #9
0
 /// <summary>
 ///     Construct a new <c>Hemisphere</c> at the point <c>center</c>, pointing in the direction of
 ///     <c>direction</c>. The radius is defined by a two-dimensional function <c>radius</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$u \in [0, 2\pi]\f$ (the azimuthal angle) and
 ///     \f$v \in [0, \frac{1}{2} \pi]\f$ (the inclination angle).
 /// </summary>
 /// <param name="center">
 ///     The position of the hemisphere.
 /// </param>
 /// <param name="direction">
 ///     The vector that defines which way is 'forward' for the object. Will be normalized on initialization.
 /// </param>
 public Hemisphere(ContinuousMap <Vector2, float> radius, Vector3 center, Vector3 direction)
     : this(radius,
            center,
            direction,
            Vector3.Cross(direction, Vector3.UnitZ),
            Vector3.Cross(direction, Vector3.Normalize(Vector3.Cross(direction, Vector3.UnitZ)))
            )
 {
 }
Example #10
0
 /// <summary>
 ///     Construct a new <c>Hemisphere</c> at the point <c>center</c>, pointing in the direction of
 ///     <c>direction</c>. The radius is defined by a two-dimensional function <c>radius</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$u \in [0, 2\pi]\f$ (the azimuthal angle) and
 ///     \f$v \in [0, \frac{1}{2} \pi]\f$ (the inclination angle).
 /// </summary>
 /// <param name="center">
 ///     The position of the hemisphere.
 /// </param>
 /// <param name="direction">
 ///     The vector that defines which way is 'forward' for the object. Will be normalized on initialization.
 /// </param>
 public Hemisphere(ContinuousMap <dvec2, double> radius, dvec3 center, dvec3 direction)
     : this(radius,
            center,
            direction,
            dvec3.Cross(direction, dvec3.UnitZ),
            dvec3.Cross(direction, dvec3.Cross(direction, dvec3.UnitZ).Normalized)
            )
 {
 }
Example #11
0
 /// <summary>
 ///     Construct a new <c>Hemisphere</c> at the point <c>center</c>, pointing in the direction of
 ///     <c>direction</c>. The radius is defined by a two-dimensional function <c>radius</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$u \in [0, 2\pi]\f$ (the azimuthal angle) and
 ///     \f$v \in [0, \frac{1}{2} \pi]\f$ (the inclination angle).
 /// </summary>
 /// <param name="center">
 ///     The position of the hemisphere.
 /// </param>
 /// <param name="direction">
 ///     The vector that defines which way is 'forward' for the object. Will be normalized on initialization.
 /// </param>
 /// <param name="normal">
 ///     The vector that defines which way is 'up' for the object. Should be perpendicular to
 ///     <c>direction</c> and <c>binormal</c>. Will be normalized on initialization.
 /// </param>
 /// <param name="binormal">
 ///     The vector that defines which way is 'left' for the object. Should be perpendicular to
 ///     <c>direction</c> and <c>normal</c>. Will be normalized on initialization.
 /// </param>
 public Hemisphere(ContinuousMap <dvec2, double> radius, dvec3 center, dvec3 direction, dvec3 normal, dvec3 binormal)
 {
     DebugUtil.AssertAllFinite(center, nameof(center));
     DebugUtil.AssertAllFinite(direction, nameof(direction));
     DebugUtil.AssertAllFinite(normal, nameof(normal));
     DebugUtil.AssertAllFinite(binormal, nameof(binormal));
     this.Radius    = radius;
     this.Center    = center;
     this.Direction = direction;
     this.Normal    = normal;
     this.Binormal  = binormal;
 }
Example #12
0
        /// <summary>
        /// Returns the surface geometry of the bone after all constraints and deformations up to this point
        /// have been taken into account.
        /// </summary>
        public override Surface GetGeometry()
        {
            // Sequentially add the influence of each joint to the bone's radial deformations:
            ContinuousMap <Vector2, float> deformations = Radius;

            foreach (var i in InteractingJoints)
            {
                MoldCastMap boneHeightMap = new MoldCastMap(CenterCurve,
                                                            i.InteractingJoint.GetRaytraceableSurface(),
                                                            deformations,
                                                            i.Direction,
                                                            i.MaxDistance);
                deformations = boneHeightMap;
            }

            return(new Capsule(CenterCurve, deformations));
        }
Example #13
0
        /// <summary>
        ///     Construct a new <c>Capsule</c> around a central curve, the <c>centerCurve</c>.
        ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
        ///
        ///     The surface is parametrized with the coordinates \f$u, \phi\f$, with \f$u\f (along the length of the
        ///     shaft) and \f$\phi \in [0, 2 \pi]\f$ along the radial coordinate. A <c>Capsule</c> consists of a
        ///     cylindrical shaft with two hemisphere end caps. $\f$u \in [-\frac{1}{2} \pi, 0]\f$ marks the region
        ///     in parametrized coordinates of the hemisphere at the start point of the cylinder,
        ///     $\f$u \in [0, 1]\f$ marks the region in parametrized coordinates of the central shaft,
        ///     and $\f$u \in [1, 1 + \frac{1}{2} \pi]\f$ marks the region in parametrized coordinates of the hemisphere
        ///     at the end point of the cylinder. The <c>heightMap</c> is a two-dimensional function defined on these
        ///     coordinates on the domain given above.
        /// </summary>
        /// <param name="centerCurve">
        ///     <inheritdoc cref="Capsule.CenterCurve"/>
        /// </param>
        /// <param name="heightMap">
        ///     The radius at each point on the surface. A <c>Capsule</c> is generated around a central curve, with each
        ///     point on the surface at a certain distance from the curve defined by <c>heightMap</c>. <c>heightMap</c>
        ///     is therefore a two-dimensional function $h(u, \phi)$ that outputs a distance from the curve at each of
        ///     the surface's parametric coordinates.
        /// </param>
        public Capsule(Curve centerCurve, ContinuousMap <Vector2, float> heightMap)
        {
            Vector3 startTangent = -centerCurve.GetTangentAt(0.0f);
            Vector3 startNormal  = centerCurve.GetNormalAt(0.0f);

            Vector3 endTangent = centerCurve.GetTangentAt(1.0f);
            Vector3 endNormal  = centerCurve.GetNormalAt(1.0f);

            this.shaft    = new Cylinder(centerCurve, heightMap);
            this.startCap = new Hemisphere(
                new ShiftedMap2D <float>(new Vector2(0.0f, -0.5f * (float)Math.PI), heightMap),
                centerCurve.GetStartPosition(),
                startTangent,
                startNormal,
                -Vector3.Cross(startTangent, startNormal)
                );
            this.endCap = new Hemisphere(
                new ShiftedMap2D <float>(new Vector2(0.0f, 1.0f + 0.5f * (float)Math.PI), new Vector2(1.0f, -1.0f), heightMap),
                centerCurve.GetEndPosition(),
                endTangent,
                endNormal,
                -Vector3.Cross(endTangent, endNormal)
                );
        }
Example #14
0
        /// <summary>
        ///     Construct a new <c>Capsule</c> around a central curve, the <c>centerCurve</c>.
        ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
        ///
        ///     The surface is parametrized with the coordinates \f$u, \phi\f$, with \f$u\f (along the length of the
        ///     shaft) and \f$\phi \in [0, 2 \pi]\f$ along the radial coordinate. A <c>Capsule</c> consists of a
        ///     cylindrical shaft with two hemisphere end caps. $\f$u \in [-\frac{1}{2} \pi, 0]\f$ marks the region
        ///     in parametrized coordinates of the hemisphere at the start point of the cylinder,
        ///     $\f$u \in [0, 1]\f$ marks the region in parametrized coordinates of the central shaft,
        ///     and $\f$u \in [1, 1 + \frac{1}{2} \pi]\f$ marks the region in parametrized coordinates of the hemisphere
        ///     at the end point of the cylinder. The <c>heightMap</c> is a two-dimensional function defined on these
        ///     coordinates on the domain given above.
        /// </summary>
        /// <param name="centerCurve">
        ///     <inheritdoc cref="Capsule.CenterCurve"/>
        /// </param>
        /// <param name="heightMap">
        ///     The radius at each point on the surface. A <c>Capsule</c> is generated around a central curve, with each
        ///     point on the surface at a certain distance from the curve defined by <c>heightMap</c>. <c>heightMap</c>
        ///     is therefore a two-dimensional function $h(u, \phi)$ that outputs a distance from the curve at each of
        ///     the surface's parametric coordinates.
        /// </param>
        public Capsule(Curve centerCurve, ContinuousMap <dvec2, double> heightMap)
        {
            dvec3 startTangent = -centerCurve.GetTangentAt(0.0);
            dvec3 startNormal  = centerCurve.GetNormalAt(0.0);

            dvec3 endTangent = centerCurve.GetTangentAt(1.0);
            dvec3 endNormal  = centerCurve.GetNormalAt(1.0);

            this.shaft    = new Cylinder(centerCurve, heightMap);
            this.startCap = new Hemisphere(
                new ShiftedMap2D <double>(new dvec2(0.0, -0.5 * Math.PI), heightMap),
                centerCurve.GetStartPosition(),
                startTangent,
                startNormal,
                -dvec3.Cross(startTangent, startNormal)
                );
            this.endCap = new Hemisphere(
                new ShiftedMap2D <double>(new dvec2(0.0, 1.0 + 0.5 * Math.PI), new dvec2(1.0, -1.0), heightMap),
                centerCurve.GetEndPosition(),
                endTangent,
                endNormal,
                -dvec3.Cross(endTangent, endNormal)
                );
        }
Example #15
0
 public HingeJoint(Line centerLine, ContinuousMap <float, float> radius)
 {
     articularSurface = new Cylinder(centerLine, radius);
 }
Example #16
0
 public LongBone(Curve centerCurve, ContinuousMap <float, float> radius)
 {
     this.CenterCurve = centerCurve;
     this.Radius      = radius;
 }
Example #17
0
 /// <summary>
 ///     Construct a pie-slice of a new <c>SymmetricCylinder</c> around a central axis, the <c>centerLine</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
 ///     The cylinder is cut in a pie-slice along the length of the shaft, defined by the angles
 ///     <c>startAngle</c> and <c>endAngle</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$t \in [0, 1]\f$ (along the length of the shaft) and
 ///     \f$\phi \in [0, 2 \pi]\f$ (along the radial coordinate).
 ///
 ///     This gives a pie-sliced cylindrical surface that is defined only between the angles <c>startAngle</c>
 ///     and <c>endAngle</c>. For example, if <c>startAngle = 0.0f</c> and <c>endAngle = Math.PI</c>, one would
 ///     get a cylinder that is sliced in half.
 /// </summary>
 /// <param name="centerLine">
 ///     <inheritdoc cref="SymmetricCylinder.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="SymmetricCylinder.Radius"/>
 /// </param>
 /// <param name="startAngle">
 ///     The starting angle of the pie-slice at each point on the central axis. <c>startAngle</c> is a
 ///     one-dimensional function \f$\alpha(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 /// <param name="endAngle">
 ///     The end angle of the pie-slice at each point on the central axis. <c>endAngle</c> is a
 ///     one-dimensional function \f$\beta(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 public SymmetricCylinder(LineSegment centerLine, RaytraceableFunction1D radius, ContinuousMap <float, float> startAngle, ContinuousMap <float, float> endAngle)
     : base(centerLine, new DomainToVector2 <float>(new Vector2(0.0f, 1.0f), radius), startAngle, endAngle)
 {
     radius1D        = radius;
     this.centerLine = centerLine;
 }
Example #18
0
 /// <summary>
 ///     Construct a new <c>LongBone</c> around a central curve, the <c>centerCurve</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional heightmap function
 ///     <c>radius</c>, only changing the radius along the length of the bone but retaining radial symmetry.
 /// </summary>
 /// <param name="centerCurve">
 ///     <inheritdoc cref="LongBone.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="LongBone.Radius"/>
 /// </param>
 public LongBone(Curve centerCurve, ContinuousMap <float, float> radius)
     : this(centerCurve, new DomainToVector2 <float>(new Vector2(0.0f, 1.0f), radius))
 {
 }
Example #19
0
 /// <summary>
 ///     Construct a new <c>LongBone</c> around a central curve, the <c>centerCurve</c>.
 ///     The radius at each point on the central axis is defined by a two-dimensional heightmap function
 ///     <c>radius</c>.
 /// </summary>
 /// <param name="centerCurve">
 ///     <inheritdoc cref="LongBone.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="LongBone.Radius"/>
 /// </param>
 public LongBone(Curve centerCurve, ContinuousMap <Vector2, float> radius)
 {
     this.CenterCurve       = centerCurve;
     this.Radius            = radius;
     this.InteractingJoints = new List <JointDeformation>(0);
 }
Example #20
0
 public HingeJoint(LineSegment centerLine, RaytraceableFunction1D radius, ContinuousMap <double, double> startAngle, ContinuousMap <double, double> endAngle)
 {
     articularSurface = new SymmetricCylinder(centerLine, radius, startAngle, endAngle);
 }
Example #21
0
 /// <summary>
 ///     Construct a new <c>LongBone</c> around a central curve, the <c>centerCurve</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional heightmap function
 ///     <c>radius</c>, only changing the radius along the length of the bone but retaining radial symmetry.
 /// </summary>
 /// <param name="centerCurve">
 ///     <inheritdoc cref="LongBone.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="LongBone.Radius"/>
 /// </param>
 public LongBone(Curve centerCurve, ContinuousMap <double, double> radius)
     : this(centerCurve, new DomainToVector2 <double>(new dvec2(0.0, 1.0), radius))
 {
 }
Example #22
0
 /// <summary>
 ///     Construct a pie-slice of a new <c>SymmetricCylinder</c> around a central axis, the <c>centerLine</c>.
 ///     The radius at each point on the central axis is defined by a one-dimensional function <c>radius</c>.
 ///     The cylinder is cut in a pie-slice along the length of the shaft, defined by the angles
 ///     <c>startAngle</c> and <c>endAngle</c>.
 ///
 ///     The surface is parametrized with the coordinates \f$t \in [0, 1]\f$ (along the length of the shaft) and
 ///     \f$\phi \in [0, 2 \pi]\f$ (along the radial coordinate).
 ///
 ///     This gives a pie-sliced cylindrical surface that is defined only between the angles <c>startAngle</c>
 ///     and <c>endAngle</c>. For example, if <c>startAngle = 0.0f</c> and <c>endAngle = Math.PI</c>, one would
 ///     get a cylinder that is sliced in half.
 /// </summary>
 /// <param name="centerLine">
 ///     <inheritdoc cref="SymmetricCylinder.CenterCurve"/>
 /// </param>
 /// <param name="radius">
 ///     <inheritdoc cref="SymmetricCylinder.Radius"/>
 /// </param>
 /// <param name="startAngle">
 ///     The starting angle of the pie-slice at each point on the central axis. <c>startAngle</c> is a
 ///     one-dimensional function \f$\alpha(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 /// <param name="endAngle">
 ///     The end angle of the pie-slice at each point on the central axis. <c>endAngle</c> is a
 ///     one-dimensional function \f$\beta(t)\f$ defined on the domain \f$t \in [0, 1]\f$, where \f$t=0\f$ is
 ///     the start point of the cylinder's central axis and \f$t=1\f$ is the end point of the cylinder's central
 ///     axis. This allows one to vary the angles of the pie-slice along the length of the shaft.
 /// </param>
 public SymmetricCylinder(LineSegment centerLine, RaytraceableFunction1D radius, ContinuousMap <double, double> startAngle, ContinuousMap <double, double> endAngle)
     : base(centerLine, new DomainToVector2 <double>(dvec2.UnitY, radius), startAngle, endAngle)
 {
     radius1D        = radius;
     this.centerLine = centerLine;
 }
Example #23
0
 public Cylinder(Curve centerCurve, ContinuousMap <float, float> radius)
 {
     this.CenterCurve = centerCurve;
     this.Radius      = radius;
 }