File: export_vecmat2_op.cc

package info (click to toggle)
openstructure 2.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 205,228 kB
  • sloc: cpp: 188,129; python: 35,361; ansic: 34,298; fortran: 3,275; sh: 286; xml: 146; makefile: 29
file content (62 lines) | stat: -rw-r--r-- 3,027 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2020 by the OpenStructure authors
//
// This library 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 3.0 of the License, or (at your option)
// any later version.
// This library 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 library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//------------------------------------------------------------------------------
#include <boost/python.hpp>
using namespace boost::python;

#include <ost/geom/geom.hh>
using namespace geom;
  
Real (*Vec2Length)(const Vec2& )                                      = &Length;
Real (*Vec2Length2)(const Vec2& )                                     = &Length2;
bool   (*Vec2Equal)(const Vec2& v1, const Vec2& v2, Real epsilon)     = &Equal;
bool   (*Mat2Equal)(const Mat2& m1, const Mat2& m2, Real epsilon)     = &Equal;
Real (*Mat2Dot)(const Vec2& v1, const Vec2& v2)                       = &Dot;
Vec2   (*Vec2CompMultiply)(const Vec2& v1, const Vec2& v2)              = &CompMultiply;
Vec2   (*Vec2CompDivide)(const Vec2& v1, const Vec2& v2)                = &CompDivide;
Real (*Mat2Det)(const Mat2& m)                                        = &Det;
Mat2   (*Mat2Invert)(const Mat2& m)                                     = &Invert;
Mat2   (*Mat2Transpose)(const Mat2& m)                                  = &Transpose;
Real (*Vec2Angle)(const Vec2& v1, const Vec2& v2)                     = &Angle;
Real (*Vec2SignedAngle)(const Vec2& v1, const Vec2& v2)                     = &SignedAngle;
Vec2   (*Vec2Normalize)(const Vec2& v1)                                 = &Normalize;
Vec2   (*Vec2Rotate)(const Vec2& v1,Real ang)                         = &Rotate;
Vec2 (*Vec2Min)(const Vec2&, const Vec2&) = &Min;
Vec2 (*Vec2Max)(const Vec2&, const Vec2&) = &Max;

void export_VecMat2_op()
{
  using namespace geom;
  
  def("Length",Vec2Length);
  def("Length2",Vec2Length2);
  def("Equal",Vec2Equal, (arg("v1"), arg("v2"), arg("epsilon")=EPSILON));
  def("CompMultiply",Vec2CompMultiply);
  def("CompDivide",Vec2CompDivide);
  def("Equal",Mat2Equal, (arg("m1"), arg("m2"), arg("epsilon")=EPSILON));
  def("Dot",Mat2Dot);
  def("Det",Mat2Det);
  def("Invert",Mat2Invert);
  def("Transpose",Mat2Transpose);
  def("Angle",Vec2Angle);
  def("SignedAngle",Vec2SignedAngle);
  def("Normalize",Vec2Normalize);
  def("Rotate",Vec2Rotate);
  def("Min",Vec2Min);
  def("Max",Vec2Max);
}