1 /* Siconos is a program dedicated to modeling, simulation and control
2  * of non smooth dynamical systems.
3  *
4  * Copyright 2021 INRIA.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17 */
18 
19 /*! \file SphereLDSPlanR.hpp
20   \brief SphereLDS relation with a plan - Inherits from LagrangianScleronomousR
21 */
22 
23 #ifndef SphereLDSPlanR_h
24 #define SphereLDSPlanR_h
25 
26 #include "MechanicsFwd.hpp"
27 #include "CircularR.hpp"
28 
29 class SphereLDSPlanR : public LagrangianScleronomousR, public std::enable_shared_from_this<SphereLDSPlanR>
30 {
31 private:
32   /** serialization hooks
33   */
34   ACCEPT_SERIALIZATION(SphereLDSPlanR);
35 
36 
37   /* Ax + By + Cz + D = 0 */
38   double r, A, B, C, D, nN, nU;
39   /* u ^ v  = n */
40   double u1, u2, u3, v1, v2, v3, n1, n2, n3, ru1, ru2, ru3, rv1, rv2, rv3;
41 
SphereLDSPlanR()42   SphereLDSPlanR() {};
43 
44 public:
45 
46   /** Constructor
47   \param r disk radius
48   \param A
49   \param B
50   \param C
51   \param D
52   */
53   SphereLDSPlanR(double r, double A, double B, double C, double D);
54 
55   double distance(double, double, double, double);
56 
57   using LagrangianScleronomousR::computeh;
58 
59 
60   /** to compute the output y = h(q,z) of the Relation
61       \param q coordinates of the dynamical systems involved in the relation
62       \param z user defined parameters (optional)
63       \param y the resulting vector
64   */
65   void computeh(const BlockVector& q, BlockVector& z, SiconosVector& y);
66 
67   /** to compute the jacobian of h(...). Set attribute _jachq (access: jacqhq())
68       \param q coordinates of the dynamical systems involved in the relation
69       \param z user defined parameters (optional)
70   */
71   void computeJachq(const BlockVector& q, BlockVector& z);
72 
equal(double _A,double _B,double _C,double _D,double _r) const73   bool equal(double _A, double _B, double _C, double _D, double _r) const
74   {
75     return (A == _A && B == _B && C == _C && D == _D && r == _r) ;
76   }
77 
78   /** visitors hook
79    */
80   ACCEPT_VISITORS();
81 
82 };
83 #endif /* SphereLDSPlanR_h */
84