License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / public-api / dynamics / dynamics-collision.h
1 #ifndef __DALI_DYNAMICS_COLLISION_H__
2 #define __DALI_DYNAMICS_COLLISION_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // BASE CLASS INCLUDES
22 #include <dali/public-api/object/base-handle.h>
23
24 namespace Dali DALI_IMPORT_API
25 {
26
27 class Actor;
28 struct Vector3;
29
30 namespace Internal DALI_INTERNAL
31 {
32
33 class DynamicsCollision;
34
35 } // namespace Internal
36
37 /**
38  * @brief Contains information about a collision between two actors.
39  */
40 class DynamicsCollision : public BaseHandle
41 {
42 public:
43   /**
44    * @brief Create an uninitialized handle.
45    *
46    * Initialized handles are received in DynamicsWorld::SignalCollision handlers
47    */
48   DynamicsCollision();
49
50   /**
51    * @brief Virtual destructor.
52    */
53   virtual ~DynamicsCollision();
54
55   /**
56    * @copydoc Dali::BaseHandle::operator=
57    */
58   using BaseHandle::operator=;
59
60 public:
61   /**
62    * @brief Get the first actor in the collision.
63    *
64    * @return The first actor in the collision
65    */
66   Actor GetActorA();
67
68   /**
69    * @brief Get the second actor in the collision.
70    *
71    * @return The second actor in the collision
72    */
73   Actor GetActorB();
74
75   /**
76    * @brief Get the force of the impact.
77    *
78    * @return the impact force
79    * @note currently returns 0.5f for a new collision and 0.0f for dispersal
80    */
81   float GetImpactForce() const;
82
83   /**
84    * @brief Get the point of contact on the first Actor.
85    *
86    * @return The point of contact on the first Actor
87    */
88   Vector3 GetPointOnA() const;
89
90   /**
91    * @brief Get the point of contact on the second Actor.
92    *
93    * @return The point of contact on the second Actor
94    */
95   Vector3 GetPointOnB() const;
96
97   /**
98    * @brief Get the collision normal.
99    *
100    * @return The collision normal
101    */
102   Vector3 GetNormal() const;
103
104   // Not intended for application developers
105 public:
106   /**
107    * @brief This constructor is used internally by Dali.
108    *
109    * @param [in] internal A pointer to a newly allocated Dali resource
110    */
111   explicit DALI_INTERNAL DynamicsCollision( Internal::DynamicsCollision* internal );
112 }; // class DynamicsCollision
113
114 } // namespace Dali
115
116 #endif /* __DALI_DYNAMICS_COLLISION_H__ */