• Create Account

# lucky6969b

Member Since 06 Apr 2007
Offline Last Active Private

### #5311045How to sample a 3D dubins path according to distance travelled?

Posted by on 16 September 2016 - 02:03 AM

I came to understand what it is doing

the ones that start with the letter 'q' is a directional vector

'w' is a positional vector

e.g.

```// # end spiral
sol.c_e = cre - D3DXVECTOR3(0, 0, -dist2*tan(gam));
sol.psi_e = theta - PI / 2;
sol.lamda_e = 1;

//# hyperplane H_s : switch from first spiral to line
sol.w_s = w1;
sol.q_s = q1;

// # hyperplane H_l: switch from line to last spiral
sol.w_l = w2;
sol.q_l = q1;

// # hyperplane H_e: end of Dubins path
sol.w_e = ze;
sol.q_e = dot(D3DXVECTOR3(1, 0, 0), rotY(anglend));
```

It is a RSR turn.

Start with the w_s, which is an end point of a spiral

and q_s is which direction it is pointing towards.

So let's say I start with position (10, 20, 30) and some direction say a radian of 1.57

If a path is found and in the case of RSR turn, there will be a spiral

between (10, 20, 30) and w_s, and the directions are already said,

which is 1.57 from the starting point and ends with q_s

So the problem reduces to finding a sampled point within the spiral itself

The other segments are found exactly the same way.

Unfortunately, I am not good at mathematics, and I couldn't find much materials

on how to go about finding the value of the sampled point...

Thanks

Jack

### #5298951Getting an error while running this program

Posted by on 03 July 2016 - 09:15 PM

I cannot get this program to run, any quick fix for me?

Python 32bit: 3.5.2

https://github.com/unr-arl/DubinsAirplane

```File "DubinsAirplaneMain.py", line 46
print '### Path Type: short climb RSR'
^
SyntaxError: invalid syntax
```

### #5297549Octile distance of 2 octants?

Posted by on 22 June 2016 - 02:17 AM

Have a nice day.

### #5296925Two-handed Reaching with OpenTissue

Posted by on 17 June 2016 - 02:39 AM

I came across the following problem when I was using OpenTissue to solve the 2 handed reaching problem.

I found that there would be a "dragging" force on both arms which cancels out each other.

For example,

the left arm IK takes effect, it will drag the body towards the left side,

And the right arm IK also in effect, it will pull back the body towards the right side.

The end result is nothing.

So I decided to do it one after the other.

the first frame solves for the left arm, the second frame the right arm...etc

alternately.

But still didn't quite get any pleasing results.

Any advice for improving this way of tackling the problem?

Thanks

Jack

### #5293491Do you usually prefix your classes with the letter 'C' or something e...

Posted by on 25 May 2016 - 11:04 PM

I think it's a good practice to do so.

I prefix stuff like CTextureManager, it is quite neat.

But when it comes to classes like

AStar, I feel very strange to have such a letter as the prefix...

I don't like to call it CAStar, which is very windy...

Thanks

Jack

### #5291571What is the best way to update a Quadtree/Octree?

Posted by on 14 May 2016 - 09:55 AM

One more tiny question to ask,
I am wondering if say a tractor of a truck enters a warehouse,
and the floor of the tractor becomes part of the world,
the quad tree is to be extended, I don't really want to extrude
that part of the quad tree in advance and pretend it was there before the truck enters,
I want the new area to be stitched to the original quad tree.
The problem being is where should I seed the pivot point

BTW, I decided not to store the ids in an array, I store them in a hash map
Anyways, the ids can be reused when required...
Thanks
Jack

### #5289728Need Help parsing the X file using D3DX?

Posted by on 02 May 2016 - 08:04 AM

I've solved it myself. I actually retrieve the parent of the parent and pass the sibling ID as the childID

to the _linkframe function, and it solved the problem

BTW, I've rewritten the _linkframe function significantly. But you can find it here

https://github.com/yorung/dx11bvh

Thanks

Jack

### #5288257towards a faster A*

Posted by on 23 April 2016 - 02:25 AM

http://www.codeproject.com/Articles/118015/Fast-A-Star-D-Implementation-for-C

This guy here wrote an extremely fast heap priority queue.

Let's try it.

It runs very fast in my program

### #5278652How to clear this offset bit?

Posted by on 29 February 2016 - 02:06 AM

I need to check it. But for the time being, it is working as normal.

But I am not sure, because I copy it off somewhere from the web.

### #5278643How to clear this offset bit?

Posted by on 29 February 2016 - 12:24 AM

```void Remove(const T* inValue)
{
int offset = inValue->x*MAXTILE_YLEN + inValue->z;
mbVisited[offset] &= ~(1 << inValue->direction);
Count--;
}

BYTE     mbVisited[MAXTILE_XLEN*MAXTILE_YLEN];```

I want to clear the corresponding mbVisited bit based on the x,y and dir given as
the argument to Remove.
But I am not sure if this would work or not?
Thanks
Jack

### #5276273How to get the total polycount in the scene from recast/detour?

Posted by on 18 February 2016 - 01:27 AM

How do I get the total polycount in the scene from recast/detour?

BTW,
when I chose tiled mesh, and keep intermediate results, there is no way to show the tiles
and tile structure in the pane, but with temp obstacle, I can see the tiles laid out
but still no polys inside the tiles?
Why?

### #5273314Smoothing out a TimeAStar Path.

Posted by on 29 January 2016 - 11:06 PM

If the returned timeastar path consists of discrete times like 1,2,3,4

and I want to interpolate it with a catmull-rom spline.

I have to blend the waypoints between time say 1 and 2

while timeastar works best with discrete time and discrete locations.

Is it possible to make the timeastar path continuous by intepolating it

with catmull rom? If I do it like that, I have to make up some

real times like 1.25, 1.50, 1.75 to add between the time of 1 and 2

and the timeastar is no longer discrete in nature.

Should I double up the waypoints this way?

I find that there is one problem with this, if 2 waypoints are really close to each other, the effect of smoothing is not prominent?

```D3DXVECTOR3& CMyApp::GotoWaypoint(const D3DXVECTOR3& vSrc, const D3DXVECTOR3& vDest, float fSpeed, bool bSmoothPath)
{
D3DXVECTOR3 vOut;
if (bSmoothPath) {
D3DXVECTOR3 p[4];
p[0] = vSrc;
p[1] = vSrc;
p[2] = vDest;
p[3] = vDest;
vOut = *D3DXVec3CatmullRom(&vOut, &p[0], &p[1], &p[2], &p[3], fSpeed);
}
else {
vOut = *D3DXVec3Lerp(&vOut, &vSrc, &vDest, fSpeed);
}
return vOut;
}```

These interpolated waypoints using catmull rom give abrupt turn to the agent

```Wp is 4.84535 0 -0.498869
Wp is 4.8462 0 -0.501389
Wp is 4.84722 0 -0.504407
Wp is 4.84823 0 -0.507419
Wp is 4.84925 0 -0.510424
Wp is 4.85026 0 -0.513422
Wp is 4.8511 0 -0.515915
Wp is 4.8521 0 -0.518901
Wp is 4.85294 0 -0.521384
Wp is 4.85394 0 -0.524357
Wp is 4.85494 0 -0.527323
Wp is 4.85577 0 -0.52979
Wp is 4.85677 0 -0.532743
Wp is 4.85776 0 -0.53569
Wp is 4.85859 0 -0.53814
Wp is 4.85974 0 -0.541561
Wp is 4.86073 0 -0.544486
Wp is 4.86155 0 -0.546918
Wp is 4.86253 0 -0.54983
Wp is 4.86351 0 -0.552735
Wp is 4.86433 0 -0.55515
Wp is 4.86546 0 -0.558522
Wp is 4.86643 0 -0.561405
Wp is 4.8674 0 -0.56428
Wp is 4.86901 0 -0.569055
Wp is 4.8703 0 -0.57286
Wp is 4.87126 0 -0.575705
Wp is 4.87237 0 -0.579015
Wp is 4.8738 0 -0.583255
Wp is 4.87475 0 -0.586071
Wp is 4.8757 0 -0.588881
Wp is 4.87664 0 -0.591682
Wp is 4.87758 0 -0.594475
Wp is 4.87852 0 -0.59726
Wp is 4.8793 0 -0.599576
Wp is 4.88024 0 -0.602346
Wp is 4.88117 0 -0.605109
Wp is 4.88194 0 -0.607405
Wp is 4.88287 0 -0.610153
Wp is 4.88379 0 -0.612893
Wp is 4.88456 0 -0.61517
Wp is 4.88548 0 -0.617895
Wp is 4.8864 0 -0.620612
Wp is 4.88731 0 -0.62332
Wp is 4.88807 0 -0.625571
Wp is 4.88913 0 -0.628711
Wp is 4.88988 0 -0.630948
Wp is 4.89078 0 -0.633624
Wp is 4.89168 0 -0.636292
Wp is 4.89243 0 -0.638508
Wp is 4.89333 0 -0.64116
Wp is 4.89422 0 -0.643803
Wp is 4.89496 0 -0.645999
Wp is 4.89584 0 -0.648627
Wp is 4.89673 0 -0.651245
Wp is 4.89746 0 -0.653421
Wp is 4.89834 0 -0.656023
Wp is 4.89965 0 -0.659911
Wp is 4.90037 0 -0.662061
Wp is 4.90124 0 -0.664634
Wp is 4.9021 0 -0.667198```

I am using

```float x = m_CharInfo[name].vEndPos.x - m_CharInfo[name].vStartPos.x;
float z = m_CharInfo[name].vEndPos.z - m_CharInfo[name].vStartPos.z;
float fNewDir = atan2f(-x, -z);
m_CharObject[name]->SetRot(D3DXVECTOR3(fNewDir, 0.0f, 0.0f));
```

This is something I would want to try.

http://www.gamasutra.com/view/feature/131505/toward_more_realistic_pathfinding.php

But the thing is if I have to test 8 starting directions from the start, and 8 ending directions it will end up with.

there are on maximum 64 transitions per iteration, which will put the burden over the cooperative pathfinding thread a lot...

How can I avoid the abrupt turn of agent?

Thanks

Jack

### #5272549Setting the maximum no of animation sets in anim controller?

Posted by on 25 January 2016 - 12:39 AM

The animation controller had only one animationset when created off the hierarchy allocator.
Now, it only allows one animationset to be available
even though I register another one later on.
How do I alter this number?
Thanks
Jack

Posted by on 13 December 2015 - 10:01 PM

You can see that the path costs are not uniform, due to the nature of quadtrees.

And I am using 4 directional moves at the moment, On the last step of this dump,

I find the the pathfinder has lost its properties.

X: -23.1811 Z 6.16012

is certainly better than

X: -20.7061 Z 13.5007

And BTW, I have enough clearance for the agent to get to its destination.

Any ideas that I can make improvements on this?

Update:

Sorry, guys, I know now, I got some unwanted geometries in my scene when generating the grid, so the destination cannot be reached.

Thanks for helping

```Src:
m_vPos = 0x000000000cb4e0bc {-18.2310867, 0.000000000, 15.9476185}

Dest:
m_vPos = 0x000000000e9f2c5c {-33.6998367, 0.000000000, -22.5906639}

From: AStar 1 X: -18.2311 Z15.9476 total_cost 44.9457 path_cost 0 estimated_cost 44.9457

From: AStar ===========
From: AStar 1 X: -18.2311 Z13.5007 total_cost 44.9457 path_cost 2.44687 estimated_cost 42.4988

From: AStar 2 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 3 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 4 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -18.2311 Z11.0539 total_cost 44.9457 path_cost 4.89375 estimated_cost 40.0519

From: AStar 2 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 3 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 4 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 5 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 6 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -18.2311 Z8.60699 total_cost 44.9457 path_cost 7.34062 estimated_cost 37.605

From: AStar 2 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 3 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 4 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 5 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 6 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 7 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 8 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -18.2311 Z6.16012 total_cost 44.9457 path_cost 9.7875 estimated_cost 35.1582

From: AStar 2 X: -20.7061 Z8.60699 total_cost 46.3955 path_cost 9.81563 estimated_cost 36.5798

From: AStar 3 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 4 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 5 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 8 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 9 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 10 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z6.16012 total_cost 46.3955 path_cost 12.2625 estimated_cost 34.133

From: AStar 2 X: -20.7061 Z8.60699 total_cost 46.3955 path_cost 9.81563 estimated_cost 36.5798

From: AStar 3 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 4 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 5 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z8.60699 total_cost 46.3955 path_cost 9.81563 estimated_cost 36.5798

From: AStar 2 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 3 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 4 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 5 X: -23.1811 Z6.16012 total_cost 47.8453 path_cost 14.7375 estimated_cost 33.1078

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 2 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 3 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 4 X: -23.1811 Z6.16012 total_cost 47.8453 path_cost 14.7375 estimated_cost 33.1078

From: AStar 5 X: -23.1811 Z8.60699 total_cost 47.8453 path_cost 12.2906 estimated_cost 35.5547

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 2 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 3 X: -23.1811 Z11.0539 total_cost 47.8453 path_cost 9.84375 estimated_cost 38.0015

From: AStar 4 X: -23.1811 Z6.16012 total_cost 47.8453 path_cost 14.7375 estimated_cost 33.1078

From: AStar 5 X: -23.1811 Z8.60699 total_cost 47.8453 path_cost 12.2906 estimated_cost 35.5547

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925
```
```AStarPath* AStar::findPath(QuadNode* start, QuadNode* destination, CObject* unit, bool bBackupMode)
{

if (start == NULL || destination == NULL)
return NULL;

bool solved = false;
int iterations = 0;

try {
start->path_cost = 0;
start->estimated_cost = start->distance(destination);
start->total_cost = start->estimated_cost;

m_OrderedOpenSet.insert(*start);

while (!m_OpenSet.IsEmpty())
{

int i = 1;
for (itr it = m_OrderedOpenSet.begin(); it != m_OrderedOpenSet.end(); it++) {
std::stringstream oss;
oss << i++ << " X: " << on.m_vPos[0] << " Z: " << on.m_vPos[2] << " total_cost " << on.total_cost << " path_cost " << on.path_cost << " estimated_cost " << on.estimated_cost << endl;
LogFileSingletonGeneral::print("AStar", oss.str());
}

LogFileSingletonGeneral::print("AStar", "===========");

if (bBackupMode) {
}

if (current->contains(destination))
{
solved = true;
}

m_OpenSet.Remove(current);

if (!m_OrderedOpenSet.empty())
m_OrderedOpenSet.erase(m_OrderedOpenSet.begin());

for (int i = 0; i < neighborNodes.size(); i++)
{
iterations++;

float cost = current->distance(neighbour);

continue;

if (m_ClosedSet.Contains(neighbour))
continue;

// in open list
if (m_OpenSet.Contains(neighbour))
{
// current is better, update the info
if (current->path_cost + cost < neighbour->path_cost)
{

// neighbour G cost greater than current->G + neighbour cost
m_OpenSet.Remove(neighbour);

if (!m_OrderedOpenSet.empty())
m_OrderedOpenSet.erase(m_OrderedOpenSet.find(*neighbour));

// sets the neighbour to the current's neighbour
neighbour->ancestor = current;
neighbour->path_cost = current->path_cost + cost;
neighbour->total_cost = neighbour->path_cost + neighbour->estimated_cost;
m_OrderedOpenSet.insert(*neighbour);

}

}
else
{

// open a new node
neighbour->ancestor = current;
neighbour->path_cost = current->path_cost + cost;
neighbour->estimated_cost = neighbour->distance(destination);
neighbour->total_cost = neighbour->path_cost + neighbour->estimated_cost;
m_OrderedOpenSet.insert(*neighbour);

}
}
}

if (solved) {
float totalCost = current->path_cost;
std::vector<AStarTransition*> transitions;
while (current->ancestor != NULL) {
transitions.emplace(transitions.begin(), new AStarTransition(current, current->ancestor));

// get where it originates from
}
cout << "Takes " << iterations << endl;

return new AStarPath(start, transitions, totalCost);
}
}
catch (...) {
cout << "\nNo Path found " << endl;
return NULL;
}

cout << "\nNo Path found " << endl;
return NULL;

}
```

### #5262688Visual Studio includes a 3d modeller!

Posted by on 18 November 2015 - 10:56 PM

Guess what.
The visual studio 2013 community already got a 3d modeller built-in
I don't even need to pay for a 3d asset converter and anything like that.
It is as easy as that

PARTNERS