Point3.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
20 // \callgraph
21 
22 #pragma once
23 
24 #include <gtsam/config.h>
25 #include <gtsam/base/VectorSpace.h>
26 #include <gtsam/base/Vector.h>
27 #include <gtsam/dllexport.h>
29 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
30 #include <boost/serialization/nvp.hpp>
31 #endif
32 #include <numeric>
33 
34 namespace gtsam {
35 
38 typedef Vector3 Point3;
39 typedef std::vector<Point3, Eigen::aligned_allocator<Point3> > Point3Vector;
40 
41 // Convenience typedef
42 using Point3Pair = std::pair<Point3, Point3>;
43 GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const gtsam::Point3Pair &p);
44 
45 using Point3Pairs = std::vector<Point3Pair>;
46 
48 GTSAM_EXPORT double distance3(const Point3& p1, const Point3& q,
49  OptionalJacobian<1, 3> H1 = {},
50  OptionalJacobian<1, 3> H2 = {});
51 
53 GTSAM_EXPORT double norm3(const Point3& p, OptionalJacobian<1, 3> H = {});
54 
56 GTSAM_EXPORT Point3 normalize(const Point3& p, OptionalJacobian<3, 3> H = {});
57 
59 GTSAM_EXPORT Point3 cross(const Point3& p, const Point3& q,
60  OptionalJacobian<3, 3> H_p = {},
61  OptionalJacobian<3, 3> H_q = {});
62 
64 GTSAM_EXPORT double dot(const Point3& p, const Point3& q,
65  OptionalJacobian<1, 3> H_p = {},
66  OptionalJacobian<1, 3> H_q = {});
67 
69 template <class CONTAINER>
70 Point3 mean(const CONTAINER& points) {
71  if (points.size() == 0) throw std::invalid_argument("Point3::mean input container is empty");
72  Point3 sum(0, 0, 0);
73  sum = std::accumulate(points.begin(), points.end(), sum);
74  return sum / points.size();
75 }
76 
78 GTSAM_EXPORT Point3Pair means(const std::vector<Point3Pair> &abPointPairs);
79 
80 template <typename A1, typename A2>
81 struct Range;
82 
83 template <>
84 struct Range<Point3, Point3> {
85  typedef double result_type;
86  double operator()(const Point3& p, const Point3& q,
87  OptionalJacobian<1, 3> H1 = {},
88  OptionalJacobian<1, 3> H2 = {}) {
89  return distance3(p, q, H1, H2);
90  }
91 };
92 
93 } // namespace gtsam
94 
std::vector< Point3, Eigen::aligned_allocator< Point3 > > Point3Vector
Definition: Point3.h:39
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Definition: testGroup.cpp:109
Eigen::Vector3d Vector3
Definition: Vector.h:43
double dot(const V1 &a, const V2 &b)
Definition: Vector.h:195
Vector3f p1
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange [*:*] noreverse nowriteback set trange [*:*] noreverse nowriteback set urange [*:*] noreverse nowriteback set vrange [*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Point3 mean(const CONTAINER &points)
mean
Definition: Point3.h:70
static void normalize(Signature::Row &row)
Definition: Signature.cpp:88
Point3 cross(const Point3 &p, const Point3 &q, OptionalJacobian< 3, 3 > H1, OptionalJacobian< 3, 3 > H2)
cross product
Definition: Point3.cpp:64
EIGEN_DEVICE_FUNC const Scalar & q
traits
Definition: chartTesting.h:28
typedef and functions to augment Eigen&#39;s VectorXd
Point2Pair means(const std::vector< Point2Pair > &abPointPairs)
Calculate the two means of a set of Point2 pairs.
Definition: Point2.cpp:116
double operator()(const Point3 &p, const Point3 &q, OptionalJacobian< 1, 3 > H1={}, OptionalJacobian< 1, 3 > H2={})
Definition: Point3.h:86
ofstream os("timeSchurFactors.csv")
float * p
serialization for Vectors
double norm3(const Point3 &p, OptionalJacobian< 1, 3 > H)
Distance of the point from the origin, with Jacobian.
Definition: Point3.cpp:41
Vector3 Point3
Definition: Point3.h:38
double distance3(const Point3 &p1, const Point3 &q, OptionalJacobian< 1, 3 > H1, OptionalJacobian< 1, 3 > H2)
distance between two points
Definition: Point3.cpp:27
std::vector< Point3Pair > Point3Pairs
Definition: Point3.h:45
std::pair< Point3, Point3 > Point3Pair
Definition: Point3.h:42


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:14