Skip to content
Snippets Groups Projects
Commit 0bda11dd authored by Simon Ottenhaus's avatar Simon Ottenhaus
Browse files

added missing files

parent 546a424e
No related branches found
No related tags found
No related merge requests found
/**
* This file is part of Simox.
*
* Simox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Simox is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
* @copyright 2018 Simon Ottenhaus
* GNU Lesser General Public License
*/
#include "TransformedFunctionR1R3.h"
#include "Helpers.h"
using namespace math;
TransformedFunctionR1R3::TransformedFunctionR1R3(const Eigen::Matrix4f& transformation, AbstractFunctionR1R3Ptr func)
: transformation(transformation), func(func)
{
}
Eigen::Vector3f TransformedFunctionR1R3::Get(float t)
{
return Helpers::TransformPosition(transformation, func->Get(t));
}
Eigen::Vector3f TransformedFunctionR1R3::GetDerivative(float t)
{
return Helpers::TransformDirection(transformation, func->GetDerivative(t));
}
/**
* This file is part of Simox.
*
* Simox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Simox is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
* @copyright 2018 Simon Ottenhaus
* GNU Lesser General Public License
*/
#pragma once
#include "AbstractFunctionR1R3.h"
namespace math
{
class TransformedFunctionR1R3 :
public AbstractFunctionR1R3
{
public:
TransformedFunctionR1R3(const Eigen::Matrix4f& transformation, AbstractFunctionR1R3Ptr func);
Eigen::Vector3f Get(float t) override;
Eigen::Vector3f GetDerivative(float t) override;
private:
const Eigen::Matrix4f transformation;
const AbstractFunctionR1R3Ptr func;
};
}
/**
* This file is part of Simox.
*
* Simox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Simox is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
* @copyright 2018 Simon Ottenhaus
* GNU Lesser General Public License
*/
#include "TransformedFunctionR2R3.h"
#include "Helpers.h"
using namespace math;
TransformedFunctionR2R3::TransformedFunctionR2R3(const Eigen::Matrix4f& transformation, AbstractFunctionR2R3Ptr func)
: transformation(transformation), inv(transformation.inverse()), func(func)
{
}
Eigen::Vector3f math::TransformedFunctionR2R3::GetPoint(float u, float v)
{
return Helpers::TransformPosition(transformation, func->GetPoint(u, v));
}
Eigen::Vector3f math::TransformedFunctionR2R3::GetDdu(float u, float v)
{
return Helpers::TransformDirection(transformation, func->GetDdu(u, v));
}
Eigen::Vector3f math::TransformedFunctionR2R3::GetDdv(float u, float v)
{
return Helpers::TransformDirection(transformation, func->GetDdv(u, v));
}
void math::TransformedFunctionR2R3::GetUV(Eigen::Vector3f pos, float& u, float& v)
{
func->GetUV(Helpers::TransformPosition(inv, pos), u, v);
}
/**
* This file is part of Simox.
*
* Simox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Simox is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
* @copyright 2018 Simon Ottenhaus
* GNU Lesser General Public License
*/
#pragma once
#include "AbstractFunctionR2R3.h"
namespace math
{
class TransformedFunctionR2R3 :
public AbstractFunctionR2R3
{
public:
TransformedFunctionR2R3(const Eigen::Matrix4f& transformation, AbstractFunctionR2R3Ptr func);
Eigen::Vector3f GetPoint(float u, float v) override;
Eigen::Vector3f GetDdu(float u, float v) override;
Eigen::Vector3f GetDdv(float u, float v) override;
void GetUV(Eigen::Vector3f pos, float& u, float& v) override;
private:
const Eigen::Matrix4f transformation;
const Eigen::Matrix4f inv;
const AbstractFunctionR2R3Ptr func;
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment