Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frustrum Python interface #278

Merged
merged 6 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ if (PYTHONLIBS_FOUND)
Cylinder_TEST
DiffDriveOdometry_TEST
Filter_TEST
Frustum_TEST
GaussMarkovProcess_TEST
Helpers_TEST
Inertial_TEST
Expand Down
95 changes: 95 additions & 0 deletions src/python/Frustum.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

%module frustum
%{
#include <ignition/math/Frustum.hh>
#include <ignition/math/Angle.hh>
#include <ignition/math/AxisAlignedBox.hh>
#include <ignition/math/Plane.hh>
#include <ignition/math/Pose3.hh>
#include <ignition/math/config.hh>
%}

namespace ignition
{
namespace math
{
class Frustum
{
/// \brief Planes that define the boundaries of the frustum.
public: enum FrustumPlane
{
/// \brief Near plane
FRUSTUM_PLANE_NEAR = 0,

/// \brief Far plane
FRUSTUM_PLANE_FAR = 1,

/// \brief Left plane
FRUSTUM_PLANE_LEFT = 2,

/// \brief Right plane
FRUSTUM_PLANE_RIGHT = 3,

/// \brief Top plane
FRUSTUM_PLANE_TOP = 4,

/// \brief Bottom plane
FRUSTUM_PLANE_BOTTOM = 5
};

public: Frustum();

public: Frustum(const double _near,
const double _far,
const ignition::math::Angle &_fov,
const double _aspectRatio,
const ignition::math::Pose3<double> &_pose = ignition::math::Pose3<double>::Zero);

public: Frustum(const Frustum &_p);

public: virtual ~Frustum();

public: double Near() const;

public: void SetNear(const double _near);

public: double Far() const;

public: void SetFar(const double _far);

public: ignition::math::Angle FOV() const;

public: void SetFOV(const ignition::math::Angle &_fov);

public: double AspectRatio() const;

public: void SetAspectRatio(const double _aspectRatio);

public: ignition::math::Plane<double> Plane(const FrustumPlane _plane) const;

public: bool Contains(const ignition::math::AxisAlignedBox &_b) const;

public: bool Contains(const ignition::math::Vector3<double> &_p) const;

public: ignition::math::Pose3<double> Pose() const;

public: void SetPose(const ignition::math::Pose3<double> &_pose);
};
}
}
Loading