C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyPathShape.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t diguyPathShape
30  **
31  *b Link against: libdiguy
32  */
33 
34 #ifndef __diguyPathShape_H
35 #define __diguyPathShape_H
36 
37 #ifdef SWIG
38 %module diguyPathShape
39 #else
40 #define CPLUSPLUS_ONLY
41 #endif
42 
43 #ifdef CPLUSPLUS_ONLY
44 class bdiScenarioPathShape;
45 class diguyWaypoint;
46 #endif
47 
48 
49 #include <declspec_diguy.h>
50 
51 /****************************************************************************/
52 class BDI_DECLSPEC_diguy diguyPathShape
53 {
54 
55 public:
56 
57  /*l
58  *b Description:
59  **
60  ** Returns the name of the path shape. This pointer will
61  ** never be NULL.
62  **
63  *b Returns:
64  **
65  ** name of the path shape
66  **
67  *b Callable From:
68  **
69  *- - C++
70  *- - Script
71  */
72  const char* get_name();
73 
74  /*l
75  *b Description:
76  **
77  ** This function sets the name of this object.
78  **
79  *b Returns:
80  **
81  ** 0 on success, -1 on failure
82  **
83  *b Callable From:
84  **
85  *- - C++
86  *- - Script
87  */
88  int set_name(const char* name);
89 
90  /*l
91  *b Description:
92  **
93  ** All path shapes are assigned a unique identifier, or uid. This
94  ** function returns this path shape's uid.
95  **
96  ** *Note*: unique identifiers will change between DI-Guy runs!
97  **
98  *b Returns:
99  **
100  ** unique identifier of object
101  **
102  *b Callable From:
103  **
104  *- - C++
105  *- - Script
106  */
107  long get_uid();
108 
109  /*l
110  *b Description:
111  **
112  ** This function determines what happens to objects following this
113  ** path when they reach the end.
114  **
115  ** If 1, the object is restricted to stay at the end of the path.
116  **
117  ** If 0, the object will wrap to the beginning of the path.
118  **
119  *b Arguments:
120  **
121  *a value - 1 to clamp, 0 to wrap
122  **
123  *b Returns:
124  **
125  ** 0 on success, -1 on failure
126  **
127  *b Callable From:
128  **
129  *- - C++
130  *- - Script
131  */
132  int set_clamp_at_end_flag(int value);
133 
134  /*l
135  *b Returns:
136  **
137  ** most recent setting of set_clamp_at_end_flag().
138  */
139  int get_clamp_at_end_flag();
140 
141  /*l
142  *b Description:
143  **
144  ** This function should be called after all modifications have
145  ** been made to the path shape and its waypoints and it is time
146  ** to re-derive the overall path shape.
147  **
148  ** This update is deferred for reasons of performance; if there
149  ** are a lot of modifications to be made to the path shape they can
150  ** all be done in a group with only a single final update.
151  **
152  ** A call to update() is typically required after certain calls
153  ** are made on objects owned by the path, such as a diguyWaypoint.
154  ** The documentation for function calls of these objects will state
155  ** whether a subsequent update() call is necessary.
156  **
157  *b Returns:
158  **
159  ** 0 on success, -1 on failure
160  **
161  *b Callable From:
162  **
163  *- - C++
164  *- - Script
165  */
166  int update();
167 
168  /*l
169  *b Description:
170  **
171  ** This function returns the total length of the path
172  ** shape, in meters.
173  **
174  *b Returns:
175  **
176  ** length of path shape in meters
177  **
178  *b Callable From:
179  **
180  *- - C++
181  *- - Script
182  */
183  float get_length();
184 
185  /*l
186  *b Description:
187  **
188  ** This function returns, via the passed variable pointers,
189  ** the position and orientation of the point on the path shape
190  ** at the specified distance.
191  **
192  *b Arguments:
193  **
194  *a distance_into_path_shape - distance in meters into path shape
195  *a of the desired point
196  *a x, y, z - position of point in meters from the origin
197  *a rz, rx, ry - orientation of point in degrees counter-clockwise
198  *a from the positive X axis
199  **
200  *b Returns:
201  **
202  ** 0 on success, -1 on failure
203  **
204  *b Callable From:
205  **
206  *- - C++
207  *- - Script
208  */
209  int get_point_at_distance(float distance_into_path_shape,
210  float* x, float* y, float* z,
211  float* rz, float* rx, float* ry);
212 
213 
214 /*****************************************************************************/
220  /*l
221  *b Returns:
222  *
223  ** the number of waypoints belonging to this path shape
224  **
225  *b Callable From:
226  **
227  *- - C++
228  *- - Script
229  */
230  int get_num_waypoints();
231 
232  /*l
233  *b Description:
234  **
235  ** This function gets the waypoint at the specified
236  ** index and returns a pointer to it. The returned
237  ** waypoint can then be queried for information or
238  ** modified.
239  **
240  ** Note that if the waypoint is modified, the update()
241  ** function must be called to update the path shape.
242  **
243  *b Arguments:
244  **
245  *a index - index of the waypoint; indices start at 0
246  **
247  *b Returns:
248  **
249  ** pointer of type diguyWaypoint; NULL if no
250  ** waypoint at the specified index
251  **
252  *b Callable From:
253  **
254  *- - C++
255  *- - Script
256  */
257  diguyWaypoint* get_waypoint_at_index(int index);
258 
259  /*l
260  *b Description:
261  **
262  ** This function creates a new waypoint that is added to the
263  ** path shape. Do not call diguyScenario::destroy_waypoint() on
264  ** the returned waypoint; it will be destroyed automatically
265  ** with the path shape.
266  **
267  *b Arguments:
268  **
269  *a tx, ty, tz - position in meters from the origin
270  *a rz, rx, ry - orientations in degrees counter-clockwise
271  *a from the positive X axis
272  *a weight - how much influence this waypoint exerts
273  *a over the path curve
274  *a index - where the waypoint should be inserted in
275  *a the path shape; indices start at 0; pass -1 to
276  *a add to end of path shape
277  **
278  *b Returns:
279  **
280  ** pointer to type diguyWaypoint
281  **
282  *b Callable From:
283  **
284  *- - C++
285  *- - Script
286  */
287  diguyWaypoint* create_waypoint(float x = 0.0f, float y = 0.0f, float z = 0.0f,
288  float yaw = 0.0f, float roll = 0.0f, float pitch = 0.0f,
289  float weight = 1.0f,
290  int index = -1);
291 
292  /*l
293  *b Description:
294  **
295  ** This function adds a waypoint to the path shape.
296  **
297  ** The waypoint should be created using the function
298  ** diguyScenario::create_waypoint(), and destroyed
299  ** using the function diguyScenario::destroy_waypoint().
300  **
301  ** An internal copy of the waypoint is made, so it can
302  ** be destroyed right after this function call or used
303  ** for other path shapes.
304  **
305  *b Arguments:
306  **
307  *a waypoint - waypoint to be appended to end of path
308  **
309  *b Returns:
310  **
311  ** 0 on success, -1 on failure
312  **
313  *b Callable From:
314  **
315  *- - C++
316  *- - Script
317  */
318  int add_waypoint(diguyWaypoint* waypoint);
319 
320 /*****************************************************************************/
326  /*l
327  *b Description:
328  **
329  ** This function tells the Navmesh regions to use this path as a
330  ** connection between two regions. The Navmesh should automatically
331  ** choose the regions closest to the start and end points of the
332  ** path. By default this functionality is off, but once activated
333  ** it's assumed to be a two way connection.
334  **
335  *b Arguments:
336  **
337  *a use_as_portal - 1 to use as a connection, 0 to not
338  **
339  *b Callable From:
340  **
341  *- - C++
342  *- - Script
343  */
344  void set_use_as_navmesh_portal(int use_as_portal);
345 
346  /*l
347  *b Description:
348  **
349  ** This function returns if the path is being used as a connection
350  ** between two regions.
351  **
352  *b Returns:
353  **
354  *a 1 if is a connection, 0 if not
355  **
356  *b Callable From:
357  **
358  *- - C++
359  *- - Script
360  */
361  int get_use_as_navmesh_portal();
362 
363  /*l
364  *b Description:
365  **
366  ** This function tells the Navmesh regions to use this path as a one
367  ** way connection between two regions. Defaults to 0 (two way
368  ** connection)
369  **
370  *b Arguments:
371  **
372  *a one_way - 1 to set as one way connection, 0 to set as
373  *a bidirectional
374  **
375  *b Callable From:
376  **
377  *- - C++
378  *- - Script
379  */
380  void set_one_way_portal(int one_way);
381 
382  /*l
383  *b Description:
384  **
385  ** This function returns if the path is being used as a one way
386  ** connection between two regions.
387  **
388  *b Returns:
389  **
390  *a 1 if is one way connection, 0 if two way
391  **
392  *b Callable From:
393  **
394  *- - C++
395  *- - Script
396  */
397  int get_one_way_portal();
398 
399 
400 /****************************************************************************/
401 /****************************************************************************/
402 /****************************************************************************/
409 /****************************************************************************/
410 /****************************************************************************/
411 /****************************************************************************/
412 
413  int translate(float tx, float ty, float tz);
414 
415  int rotate_about_point(float rz, float rx, float ry,
416  float rotation_pt_x, float rotation_pt_y, float rotation_pt_z);
417 
418  int set_ground_clamp_when_on_path(int ground_clamp_when_on_path);
419  int get_ground_clamp_when_on_path();
420 
425 #ifdef CPLUSPLUS_ONLY
426 
427  bdiScenarioPathShape* get_scripted_object() {return m_path_shape;}
428 
429 private:
431  /*l
432  ** A private constructor.
433  */
434  diguyPathShape(bdiScenarioPathShape* path_shape);
435 
436  /*l
437  ** A pointer to internal data.
438  */
439  bdiScenarioPathShape* m_path_shape;
440 
441  friend class bdiScenarioPathShape;
442  friend class diguyScenario;
443 
444 #endif
445 
446 };
447 
448 #endif /* __diguyPathShape_H */
449