12#ifndef ARCCORE_BASE_MATHREAL2_H
13#define ARCCORE_BASE_MATHREAL2_H
17#include "arccore/base/Real2.h"
18#include "arccore/base/MathBase.h"
31 inline constexpr ARCCORE_HOST_DEVICE
bool isNearlyZero(
const Real2& v)
33 return math::isNearlyZero(v.
x) && math::isNearlyZero(v.
y);
39 return v.
x * v.
x + v.
y * v.
y;
43 inline ARCCORE_HOST_DEVICE
Real normL2(
const Real2& v)
57 Real d = math::normL2(v);
71 Real d = math::normL2(v);
87inline constexpr ARCCORE_HOST_DEVICE
bool Real2::
90 return math::isNearlyZero(*
this);
96 return math::normL2(*
this);
108 return math::normL2(*
this);
Class managing a 2-dimensional real vector.
__host__ __device__ Real normL2() const
Returns the norm of the pair $ .
constexpr __host__ __device__ Real2()
Constructs the zero vector.
constexpr __host__ __device__ bool isNearlyZero() const
Indicates if the instance is close to the zero instance.
__host__ __device__ Real abs() const
Returns the norm of the pair $ .
Real2 & normalize()
Normalizes the pair.
constexpr __host__ __device__ Real2 & divSame(Real b)
Divides each component of the pair by b.
Namespace for mathematical functions.
Real2 normalizeL2(const Real2 &v)
Returns the pair v normalized by the L2 norm.
constexpr __host__ __device__ DataType squareNormL2(const NumVector< DataType, Size > &v)
Returns the square of the L2 norm of the vector.
bool isZero(const BuiltInProxy< _Type > &a)
Tests if a value is exactly equal to zero.
Real2 & mutableNormalize(Real2 &v)
Normalizes the pair.
apfloat sqrt(apfloat v)
Square root of v.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
double Real
Type representing a real number.
Real y
second component of the pair
Real x
first component of the pair