hermite_curve.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2009-2021 Intel Corporation
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include "../common/default.h"
  5. #include "bezier_curve.h"
  6. namespace embree
  7. {
  8. template<typename Vertex>
  9. struct HermiteCurveT : BezierCurveT<Vertex>
  10. {
  11. __forceinline HermiteCurveT() {}
  12. __forceinline HermiteCurveT(const BezierCurveT<Vertex>& curve)
  13. : BezierCurveT<Vertex>(curve) {}
  14. __forceinline HermiteCurveT(const Vertex& v0, const Vertex& t0, const Vertex& v1, const Vertex& t1)
  15. : BezierCurveT<Vertex>(v0,madd(1.0f/3.0f,t0,v0),nmadd(1.0f/3.0f,t1,v1),v1) {}
  16. __forceinline HermiteCurveT<Vec3ff> xfm_pr(const LinearSpace3fa& space, const Vec3fa& p) const
  17. {
  18. const Vec3ff q0(xfmVector(space,this->v0-p), this->v0.w);
  19. const Vec3ff q1(xfmVector(space,this->v1-p), this->v1.w);
  20. const Vec3ff q2(xfmVector(space,this->v2-p), this->v2.w);
  21. const Vec3ff q3(xfmVector(space,this->v3-p), this->v3.w);
  22. return BezierCurveT<Vec3ff>(q0,q1,q2,q3);
  23. }
  24. };
  25. template<typename CurveGeometry>
  26. __forceinline HermiteCurveT<Vec3ff> enlargeRadiusToMinWidth(const IntersectContext* context, const CurveGeometry* geom, const Vec3fa& ray_org, const HermiteCurveT<Vec3ff>& curve) {
  27. return HermiteCurveT<Vec3ff>(enlargeRadiusToMinWidth(context,geom,ray_org,BezierCurveT<Vec3ff>(curve)));
  28. }
  29. typedef HermiteCurveT<Vec3fa> HermiteCurve3fa;
  30. }