# How to find the right direction to plug a sword into a rig's hand after projecting it?

I've downloaded BVH animations and projected it following a book. I can now see a 3D moving rig and it looks alright. The problem is, now I want to plug a sword on the hand of the rig, but I don't know which direction it should face. That is because each vertex has a rotation and an offset, so I can calculate their positions, but there is no information available about their normals. How is this done?

Pseudocode of the position finding procedure for illustration

calculate_position(bone)
local = bone.rotation_x * bone.rotation_y * bone.rotation_z # matrices
local[3] = bone.offset_x
local[7] = bone.offset_y
local[11] = bone.offset_z
global = local * bone.parent.global
return [global[3], global[7], global[11]]