fix curve implementation

This commit is contained in:
bolero-MURAKAMI 2015-01-11 23:29:58 +09:00
parent b55e74de78
commit 1c758320b6
5 changed files with 36 additions and 8 deletions

View file

@ -129,12 +129,12 @@ namespace sprout {
template<typename P0, typename P1, typename P2, typename... PTail, typename T>
inline SPROUT_CONSTEXPR typename sprout::math::curve_point_result<sprout::tuples::tuple<P0 const&, P1 const&, P2 const&, PTail const&...> >::type
bezier(T const& t, P0 const& p0, P1 const& p1, P2 const& p2, PTail const&... p) {
return sprout::math::bezier(sprout::tuples::forward_as_tuple(p0, p1, p2, p...), t);
return sprout::math::bezier(t, sprout::tuples::forward_as_tuple(p0, p1, p2, p...));
}
template<std::size_t N, typename P0, typename P1, typename P2, typename... PTail, typename T>
inline SPROUT_CONSTEXPR typename sprout::math::curve_point_result<sprout::tuples::tuple<P0 const&, P1 const&, P2 const&, PTail const&...> >::type
bezier(T const& t, P0 const& p0, P1 const& p1, P2 const& p2, PTail const&... p) {
return sprout::math::bezier<N>(sprout::tuples::forward_as_tuple(p0, p1, p2, p...), t);
return sprout::math::bezier<N>(t, sprout::tuples::forward_as_tuple(p0, p1, p2, p...));
}
} // namespace math

View file

@ -100,17 +100,17 @@ namespace sprout {
template<typename P0, typename P1, typename P2, typename P3, typename T>
inline SPROUT_CONSTEXPR typename sprout::math::curve_point_result<sprout::tuples::tuple<P0 const&, P1 const&, P2 const&, P3 const&> >::type
catmull_rom_sprine(T const& t, P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3) {
return sprout::math::catmull_rom_sprine(sprout::tuples::forward_as_tuple(p0, p1, p2, p3), t);
return sprout::math::catmull_rom_sprine(t, sprout::tuples::forward_as_tuple(p0, p1, p2, p3));
}
template<typename P0, typename P1, typename P2, typename T>
inline SPROUT_CONSTEXPR typename sprout::math::curve_point_result<sprout::tuples::tuple<P0 const&, P1 const&, P2 const&> >::type
catmull_rom_sprine_start(T const& t, P0 const& p0, P1 const& p1, P2 const& p2) {
return sprout::math::catmull_rom_sprine_start(sprout::tuples::forward_as_tuple(p0, p1, p2), t);
return sprout::math::catmull_rom_sprine_start(t, sprout::tuples::forward_as_tuple(p0, p1, p2));
}
template<typename P0, typename P1, typename P2, typename T>
inline SPROUT_CONSTEXPR typename sprout::math::curve_point_result<sprout::tuples::tuple<P0 const&, P1 const&, P2 const&> >::type
catmull_rom_sprine_end(T const& t, P0 const& p0, P1 const& p1, P2 const& p2) {
return sprout::math::catmull_rom_sprine_end(sprout::tuples::forward_as_tuple(p0, p1, p2), t);
return sprout::math::catmull_rom_sprine_end(t, sprout::tuples::forward_as_tuple(p0, p1, p2));
}
} // namespace math

View file

@ -50,7 +50,7 @@ namespace sprout {
SPROUT_CONSTEXPR typename sprout::tuples::tuple_construct_traits<Tuple>::copied_type
default_make_tuple(Args&&... args) {
typedef typename sprout::tuples::tuple_construct_traits<Tuple>::copied_type copied_type;
return copied_type(SPROUT_FORWARD(Args, args)...);
return copied_type{SPROUT_FORWARD(Args, args)...};
}
} // namespace detail

View file

@ -102,4 +102,32 @@ namespace sprout {
using sprout::types::rebind_types;
} // namespace sprout
#include <type_traits>
#include <sprout/tpp/algorithm/all_of.hpp>
namespace sprout {
namespace types {
namespace detail {
template<template<typename, std::size_t> class ArrayLikeClass, typename T, std::size_t N>
struct rebind_types_default<ArrayLikeClass<T, N> > {
private:
template<bool C, typename Head, typename... Tail>
struct apply_impl {};
template<typename Head, typename... Tail>
struct apply_impl<true, Head, Tail...>
: public sprout::identity<ArrayLikeClass<Head, 1 + sizeof...(Tail)> >
{};
public:
template<typename Head, typename... Tail>
struct apply
: public apply_impl<
sprout::tpp::all_of_c<std::is_same<Head, Tail>::value...>::value,
Head, Tail...
>
{};
};
} // namespace detail
} // namespace types
} // namespace sprout
#endif // #ifndef SPROUT_TYPE_REBIND_TYPES_HPP

View file

@ -16,7 +16,6 @@
#include <sprout/index_tuple/make_index_tuple.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type/rebind_types.hpp>
#include <sprout/detail/nil_base.hpp>
namespace sprout {
@ -140,7 +139,6 @@ namespace sprout {
} // namespace types
using sprout::types::type_tuple;
using sprout::types::rebind_types;
} // namespace sprout
namespace std {
@ -209,4 +207,6 @@ namespace sprout {
} // namespace types
} // namespace sprout
#include <sprout/type/rebind_types.hpp>
#endif // #ifndef SPROUT_TYPE_TYPE_TUPLE_DECL_HPP