当前位置: 首页>>代码示例>>C++>>正文


C++ Bivector类代码示例

本文整理汇总了C++中Bivector的典型用法代码示例。如果您正苦于以下问题:C++ Bivector类的具体用法?C++ Bivector怎么用?C++ Bivector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Bivector类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(PluginCompatibilityTest, PreBorel) {
  serialization::Multivector message;

  Vector<Length, Barycentric> const v({ -1 * Metre, 2 * Metre, 3 * Metre });
  v.WriteToMessage(&message);
  message.mutable_frame()->set_tag(serialization::Frame::PRE_BOREL_BARYCENTRIC);
  Vector<Length, Barycentric> const w =
    Vector<Length, Barycentric>::ReadFromMessage(message);
  Vector<Length, Barycentric> const expected_w(
  { -1 * Metre, 3 * Metre, 2 * Metre });
  EXPECT_EQ(expected_w, w);

  Bivector<Length, Barycentric> const b({ 4 * Metre, 5 * Metre, -6 * Metre });
  b.WriteToMessage(&message);
  message.mutable_frame()->set_tag(serialization::Frame::PRE_BOREL_BARYCENTRIC);
  Bivector<Length, Barycentric> const c =
    Bivector<Length, Barycentric>::ReadFromMessage(message);
  Bivector<Length, Barycentric> const expected_c(
  { -4 * Metre, 6 * Metre, -5 * Metre });
  EXPECT_EQ(expected_c, c);

  Trivector<Length, Barycentric> const t(-7 * Metre);
  t.WriteToMessage(&message);
  message.mutable_frame()->set_tag(serialization::Frame::PRE_BOREL_BARYCENTRIC);
  Trivector<Length, Barycentric> const u =
    Trivector<Length, Barycentric>::ReadFromMessage(message);
  Trivector<Length, Barycentric> const expected_u(7 * Metre);
  EXPECT_EQ(expected_u, u);
}
开发者ID:Wavechaser,项目名称:Principia,代码行数:29,代码来源:plugin_compatibility_test.cpp

示例2: Exp

Rotation<Frame, Frame> Exp(Bivector<quantities::Angle, Frame> const& exponent) {
  quantities::Angle const angle = exponent.Norm();
  if (angle == quantities::Angle()) {
    return Rotation<Frame, Frame>::Identity();
  } else {
    return Rotation<Frame, Frame>(angle, exponent);
  }
}
开发者ID:ThomasKerman,项目名称:Principia,代码行数:8,代码来源:grassmann_body.hpp

示例3: GeometricAcceleration

Rotation<Frenet<ThisFrame>, ThisFrame>
DynamicFrame<InertialFrame, ThisFrame>::FrenetFrame(
    Instant const& t,
    DegreesOfFreedom<ThisFrame> const& degrees_of_freedom) const {
  Velocity<ThisFrame> const& velocity = degrees_of_freedom.velocity();
  Vector<Acceleration, ThisFrame> const acceleration =
      GeometricAcceleration(t, degrees_of_freedom);
  Vector<Acceleration, ThisFrame> normal_acceleration = acceleration;
  velocity.template Orthogonalize<Acceleration>(&normal_acceleration);
  Vector<double, ThisFrame> tangent = Normalize(velocity);
  Vector<double, ThisFrame> normal = Normalize(normal_acceleration);
  Bivector<double, ThisFrame> binormal = Wedge(tangent, normal);
  // Maps |tangent| to {1, 0, 0}, |normal| to {0, 1, 0}, and |binormal| to
  // {0, 0, 1}.
  return Rotation<Frenet<ThisFrame>, ThisFrame>(
      R3x3Matrix(tangent.coordinates(),
                 normal.coordinates(),
                 binormal.coordinates()).Transpose());
}
开发者ID:Wavechaser,项目名称:Principia,代码行数:19,代码来源:dynamic_frame_body.hpp

示例4:

Bivector<Scalar, ToFrame> Identity<FromFrame, ToFrame>::operator()(
    Bivector<Scalar, FromFrame> const& bivector) const {
  return Bivector<Scalar, ToFrame>(bivector.coordinates());
}
开发者ID:tnuvoletta,项目名称:Principia,代码行数:4,代码来源:identity_body.hpp

示例5:

Vector<quantities::Product<LScalar, RScalar>, Frame> operator*(
    Trivector<LScalar, Frame> const& left,
    Bivector<RScalar, Frame> const& right) {
  return Vector<quantities::Product<LScalar, RScalar>, Frame>(
      left.coordinates() * right.coordinates());
}
开发者ID:ThomasKerman,项目名称:Principia,代码行数:6,代码来源:grassmann_body.hpp

示例6: AngleBetween

quantities::Angle AngleBetween(Bivector<LScalar, Frame> const& v,
                               Bivector<RScalar, Frame> const& w) {
  auto const v_norm_w = v * w.Norm();
  auto const w_norm_v = w * v.Norm();
  return 2 * ArcTan((v_norm_w - w_norm_v).Norm(), (v_norm_w + w_norm_v).Norm());
}
开发者ID:ThomasKerman,项目名称:Principia,代码行数:6,代码来源:grassmann_body.hpp

示例7: Commutator

Bivector<quantities::Product<LScalar, RScalar>, Frame> Commutator(
    Bivector<LScalar, Frame> const& left,
    Bivector<RScalar, Frame> const& right) {
  return Bivector<quantities::Product<LScalar, RScalar>, Frame>(
      Cross(left.coordinates(), right.coordinates()));
}
开发者ID:ThomasKerman,项目名称:Principia,代码行数:6,代码来源:grassmann_body.hpp

示例8: Wedge

Trivector<quantities::Product<LScalar, RScalar>, Frame> Wedge(
    Vector<LScalar, Frame> const& left,
    Bivector<RScalar, Frame> const& right) {
  return Trivector<quantities::Product<LScalar, RScalar>, Frame>(
      Dot(left.coordinates(), right.coordinates()));
}
开发者ID:ThomasKerman,项目名称:Principia,代码行数:6,代码来源:grassmann_body.hpp

示例9: InnerProduct

quantities::Product<LScalar, RScalar> InnerProduct(
    Bivector<LScalar, Frame> const& left,
    Bivector<RScalar, Frame> const& right) {
  return Dot(left.coordinates(), right.coordinates());
}
开发者ID:ThomasKerman,项目名称:Principia,代码行数:5,代码来源:grassmann_body.hpp

示例10: Bivector

    Bivector operator*(const BaseTransformation &transformation, const Bivector &bivector)
    {
        return Bivector(transformation * bivector.u(), transformation * bivector.v());
    }
开发者ID:mattfischer,项目名称:raytrace,代码行数:4,代码来源:Bivector.cpp

示例11: Exp

Rotation<Frame, Frame> Exp(Bivector<quantities::Angle, Frame> const& exponent) {
  return Rotation<Frame, Frame>(exponent.Norm(), exponent);
}
开发者ID:tnuvoletta,项目名称:Principia,代码行数:3,代码来源:grassmann_body.hpp

示例12: Cross

inline Vector<quantities::Product<LScalar, RScalar>, Frame> operator*(
    Bivector<LScalar, Frame> const& left,
    Vector<RScalar, Frame> const& right) {
  return Vector<quantities::Product<LScalar, RScalar>, Frame>(
      Cross(left.coordinates(), right.coordinates()));
}
开发者ID:tnuvoletta,项目名称:Principia,代码行数:6,代码来源:grassmann_body.hpp

示例13: Determinant

Bivector<Scalar, ToFrame> Permutation<FromFrame, ToFrame>::operator()(
    Bivector<Scalar, FromFrame> const& bivector) const {
  return Bivector<Scalar, ToFrame>(
      Determinant() * (*this)(bivector.coordinates()));
}
开发者ID:Artoria2e5,项目名称:Principia,代码行数:5,代码来源:permutation_body.hpp


注:本文中的Bivector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。