概要
windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
練習問題やってみた。
練習問題
bvhファイルをパースして、モーションをアニメーションせよ。
写真
サンプルコード
上手く動いていない。どこか、間違えている。
require 'sketchup.rb'
class BVH2
class Joint
def initialize(name = nil, offset = [0.0, 0.0, 0.0], channel = [], children = [])
@name = name
@offset = offset
@channel = channel
@children = children
end
attr_accessor :name, :offset, :channel, :children
end
attr_reader :joint, :frame, :frame_time
def root
@joint - (@joint.collect {|j| j.children }.flatten.uniq)
end
def load(src)
renum = /[-+]?(?:[0-9]+(?:\.[0-9]*)?|(?:\.[0-9]+))(?:[eE][-+]?[0-9]+)?/
mode = nil
hierarchy = []
src.split(/\n/).each do |line|
case mode
when :hierarchy
case line.chomp.strip
when /^#/ #ignore
when /^MOTION/
mode = :motion
when /^ROOT\s+(\S+)/
joint = Joint.new($1)
@joint.push(joint)
hierarchy.push(joint)
when /^JOINT\s+(\S+)/
joint = Joint.new($1)
@joint.push(joint)
hierarchy.push(joint)
when /^End Site/
joint = Joint.new(nil)
hierarchy.push(joint)
when /^CHANNELS\s+(\d+)\s+(.+)/
hierarchy.last.channel = $2.split(/\s/)
when /^OFFSET\s+(#{renum})\s+(#{renum})\s+(#{renum})/
hierarchy.last.offset = [$1.to_f, $2.to_f, $3.to_f]
when /^\{/
when /^\}/
joint = hierarchy.pop
if hierarchy.last then
hierarchy.last.children ||= []
hierarchy.last.children.push(joint)
end
end
when :motion
case line.chomp.strip
when /^#/ #ignore
when /^HIERARCHY/
mode = :hierarchy
when /^Frames:\s*(\d+)/
when /^Frame Time:\s*(#{renum})/
@frame_time = $1.to_f
when /^(#{renum}\s*)+/
data = $&.split(/\s+/).collect {|s| s.to_f}
frame = {}
@joint.each do |joint|
joint_data = {}
joint.channel.each do |channel|
joint_data[channel] = data.shift
end
frame[joint.name] = joint_data
end
@frame.push(frame)
end
else
case line.chomp.strip
when /^HIERARCHY/
mode = :hierarchy
when /^MOTION/
mode = :motion
else
#ignore
end
end
end
self
end
def initialize
@joint = []
@frame = []
@frame_time = 1.0 / 30.0
model = Sketchup.active_model
entities = model.active_entities
@view = model.active_view
fso = UI.openpanel "Select .bvh file", "", "*.bvh"
return unless fso
$bvh = self.load(File.read(fso))
@hips = entities.add_group
circle = @hips.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @hips.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@hips.transform! trans
@hips.material = "Gray"
@chest = entities.add_group
circle = @chest.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @chest.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@chest.transform! trans
trans = Geom::Transformation.translation $bvh.joint[1].offset
@chest.transform! trans
@neck = entities.add_group
circle = @neck.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @neck.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@neck.transform! trans
trans = Geom::Transformation.translation $bvh.joint[1].offset
@neck.transform! trans
trans = Geom::Transformation.translation $bvh.joint[2].offset
@neck.transform! trans
@head = entities.add_group
circle = @head.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @head.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@head.transform! trans
trans = Geom::Transformation.translation $bvh.joint[1].offset
@head.transform! trans
trans = Geom::Transformation.translation $bvh.joint[2].offset
@head.transform! trans
trans = Geom::Transformation.translation $bvh.joint[3].offset
@head.transform! trans
@head.material = "Gray"
@leftCollar = entities.add_group
circle = @leftCollar.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftCollar.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftCollar.transform! trans
trans = Geom::Transformation.translation $bvh.joint[4].offset
@leftCollar.transform! trans
@leftUpArm = entities.add_group
circle = @leftUpArm.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftUpArm.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftUpArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[4].offset
@leftUpArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[5].offset
@leftUpArm.transform! trans
@leftLowArm = entities.add_group
circle = @leftLowArm.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftLowArm.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftLowArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[4].offset
@leftLowArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[5].offset
@leftLowArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[6].offset
@leftLowArm.transform! trans
@leftHand = entities.add_group
circle = @leftHand.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftHand.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[4].offset
@leftHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[5].offset
@leftHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[6].offset
@leftHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[7].offset
@leftHand.transform! trans
@leftHand.material = "Red"
@rightCollar = entities.add_group
circle = @rightCollar.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightCollar.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightCollar.transform! trans
trans = Geom::Transformation.translation $bvh.joint[8].offset
@rightCollar.transform! trans
@rightUpArm = entities.add_group
circle = @rightUpArm.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightUpArm.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightUpArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[8].offset
@rightUpArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[9].offset
@rightUpArm.transform! trans
@rightLowArm = entities.add_group
circle = @rightLowArm.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightLowArm.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightLowArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[8].offset
@rightLowArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[9].offset
@rightLowArm.transform! trans
trans = Geom::Transformation.translation $bvh.joint[10].offset
@rightLowArm.transform! trans
@rightHand = entities.add_group
circle = @rightHand.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightHand.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[8].offset
@rightHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[9].offset
@rightHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[10].offset
@rightHand.transform! trans
trans = Geom::Transformation.translation $bvh.joint[11].offset
@rightHand.transform! trans
@rightHand.material = "Red"
@leftUpLeg = entities.add_group
circle = @leftUpLeg.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftUpLeg.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftUpLeg.transform! trans
trans = Geom::Transformation.translation $bvh.joint[12].offset
@leftUpLeg.transform! trans
@leftLowLeg = entities.add_group
circle = @leftLowLeg.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftLowLeg.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftLowLeg.transform! trans
trans = Geom::Transformation.translation $bvh.joint[12].offset
@leftLowLeg.transform! trans
trans = Geom::Transformation.translation $bvh.joint[13].offset
@leftLowLeg.transform! trans
@leftFoot = entities.add_group
circle = @leftFoot.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @leftFoot.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@leftFoot.transform! trans
trans = Geom::Transformation.translation $bvh.joint[12].offset
@leftFoot.transform! trans
trans = Geom::Transformation.translation $bvh.joint[13].offset
@leftFoot.transform! trans
trans = Geom::Transformation.translation $bvh.joint[14].offset
@leftFoot.transform! trans
@leftFoot.material = "Black"
@rightUpLeg = entities.add_group
circle = @rightUpLeg.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightUpLeg.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightUpLeg.transform! trans
trans = Geom::Transformation.translation $bvh.joint[15].offset
@rightUpLeg.transform! trans
@rightLowLeg = entities.add_group
circle = @rightLowLeg.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightLowLeg.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightLowLeg.transform! trans
trans = Geom::Transformation.translation $bvh.joint[15].offset
@rightLowLeg.transform! trans
trans = Geom::Transformation.translation $bvh.joint[16].offset
@rightLowLeg.transform! trans
@rightFoot = entities.add_group
circle = @rightFoot.entities.add_circle [0, 0, 0], [0, 1, 0], 1, 8
circle_face = @rightFoot.entities.add_face circle
circle_face.pushpull -3.0
trans = Geom::Transformation.translation $bvh.joint[0].offset
@rightFoot.transform! trans
trans = Geom::Transformation.translation $bvh.joint[15].offset
@rightFoot.transform! trans
trans = Geom::Transformation.translation $bvh.joint[16].offset
@rightFoot.transform! trans
trans = Geom::Transformation.translation $bvh.joint[17].offset
@rightFoot.transform! trans
@rightFoot.material = "Black"
@n = 0
@id = UI.start_timer(3.0, true) {
tick
}
end
def tick
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@hips.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@hips.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
@hips.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@hips.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@chest.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@chest.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@chest.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@chest.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Xrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Xrotation"] - $bvh.frame[@n - 1]["Chest"]["Xrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, X_AXIS, (sa).degrees
@chest.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Yrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Yrotation"] - $bvh.frame[@n - 1]["Chest"]["Yrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Y_AXIS, (sa).degrees
@chest.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Zrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Zrotation"] - $bvh.frame[@n - 1]["Chest"]["Zrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Z_AXIS, (sa).degrees
@chest.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@neck.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Xrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Xrotation"] - $bvh.frame[@n - 1]["Chest"]["Xrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, X_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Yrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Yrotation"] - $bvh.frame[@n - 1]["Chest"]["Yrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Y_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Zrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Zrotation"] - $bvh.frame[@n - 1]["Chest"]["Zrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Z_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Neck"]["Xrotation"]
else
sa = $bvh.frame[@n]["Neck"]["Xrotation"] - $bvh.frame[@n - 1]["Neck"]["Xrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, X_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Neck"]["Yrotation"]
else
sa = $bvh.frame[@n]["Neck"]["Yrotation"] - $bvh.frame[@n - 1]["Neck"]["Yrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Y_AXIS, (sa).degrees
@neck.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Neck"]["Zrotation"]
else
sa = $bvh.frame[@n]["Neck"]["Zrotation"] - $bvh.frame[@n - 1]["Neck"]["Zrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Z_AXIS, (sa).degrees
@neck.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@head.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Xrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Xrotation"] - $bvh.frame[@n - 1]["Chest"]["Xrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, X_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Yrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Yrotation"] - $bvh.frame[@n - 1]["Chest"]["Yrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Y_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Chest"]["Zrotation"]
else
sa = $bvh.frame[@n]["Chest"]["Zrotation"] - $bvh.frame[@n - 1]["Chest"]["Zrotation"]
end
trans = Geom::Transformation.rotation @chest.bounds.center, Z_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Neck"]["Xrotation"]
else
sa = $bvh.frame[@n]["Neck"]["Xrotation"] - $bvh.frame[@n - 1]["Neck"]["Xrotation"]
end
trans = Geom::Transformation.rotation @neck.bounds.center, X_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Neck"]["Yrotation"]
else
sa = $bvh.frame[@n]["Neck"]["Yrotation"] - $bvh.frame[@n - 1]["Neck"]["Yrotation"]
end
trans = Geom::Transformation.rotation @neck.bounds.center, Y_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Neck"]["Zrotation"]
else
sa = $bvh.frame[@n]["Neck"]["Zrotation"] - $bvh.frame[@n - 1]["Neck"]["Zrotation"]
end
trans = Geom::Transformation.rotation @neck.bounds.center, Z_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Head"]["Xrotation"]
else
sa = $bvh.frame[@n]["Head"]["Xrotation"] - $bvh.frame[@n - 1]["Head"]["Xrotation"]
end
trans = Geom::Transformation.rotation @head.bounds.center, X_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Head"]["Yrotation"]
else
sa = $bvh.frame[@n]["Head"]["Yrotation"] - $bvh.frame[@n - 1]["Head"]["Yrotation"]
end
trans = Geom::Transformation.rotation @head.bounds.center, Y_AXIS, (sa).degrees
@head.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Head"]["Zrotation"]
else
sa = $bvh.frame[@n]["Head"]["Zrotation"] - $bvh.frame[@n - 1]["Head"]["Zrotation"]
end
trans = Geom::Transformation.rotation @head.bounds.center, Z_AXIS, (sa).degrees
@head.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftCollar.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, X_AXIS, (sa).degrees
@leftCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Y_AXIS, (sa).degrees
@leftCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Z_AXIS, (sa).degrees
@leftCollar.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftUpArm.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, X_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Y_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Z_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Xrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, X_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Yrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, Y_AXIS, (sa).degrees
@leftUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Zrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, Z_AXIS, (sa).degrees
@leftUpArm.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftLowArm.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, X_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Y_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Z_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Xrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, X_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Yrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, Y_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Zrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, Z_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftLowArm"]["Xrotation"] - $bvh.frame[@n - 1]["LeftLowArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftLowArm.bounds.center, X_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftLowArm"]["Yrotation"] - $bvh.frame[@n - 1]["LeftLowArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftLowArm.bounds.center, Y_AXIS, (sa).degrees
@leftLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftLowArm"]["Zrotation"] - $bvh.frame[@n - 1]["LeftLowArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftLowArm.bounds.center, Z_AXIS, (sa).degrees
@leftLowArm.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftHand.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Xrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, X_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Yrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Y_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftCollar"]["Zrotation"] - $bvh.frame[@n - 1]["LeftCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftCollar.bounds.center, Z_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Xrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, X_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Yrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, Y_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftUpArm"]["Zrotation"] - $bvh.frame[@n - 1]["LeftUpArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftUpArm.bounds.center, Z_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftLowArm"]["Xrotation"] - $bvh.frame[@n - 1]["LeftLowArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftLowArm.bounds.center, X_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftLowArm"]["Yrotation"] - $bvh.frame[@n - 1]["LeftLowArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftLowArm.bounds.center, Y_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftLowArm"]["Zrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftLowArm.bounds.center, Z_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftHand"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftHand"]["Xrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftHand.bounds.center, X_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftHand"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftHand"]["Yrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftHand.bounds.center, Y_AXIS, (sa).degrees
@leftHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftHand"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftHand"]["Zrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftHand.bounds.center, Z_AXIS, (sa).degrees
@leftHand.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightCollar.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, X_AXIS, (sa).degrees
@rightCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Y_AXIS, (sa).degrees
@rightCollar.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Z_AXIS, (sa).degrees
@rightCollar.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightUpArm.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, X_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Y_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Z_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Xrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, X_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Yrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, Y_AXIS, (sa).degrees
@rightUpArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Zrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, Z_AXIS, (sa).degrees
@rightUpArm.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightLowArm.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, X_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Y_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Z_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Xrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, X_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Yrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, Y_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Zrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, Z_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightLowArm"]["Xrotation"] - $bvh.frame[@n - 1]["RightLowArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightLowArm.bounds.center, X_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightLowArm"]["Yrotation"] - $bvh.frame[@n - 1]["RightLowArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightLowArm.bounds.center, Y_AXIS, (sa).degrees
@rightLowArm.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightLowArm"]["Zrotation"] - $bvh.frame[@n - 1]["RightLowArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightLowArm.bounds.center, Z_AXIS, (sa).degrees
@rightLowArm.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightHand.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Xrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, X_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Yrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Y_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightCollar"]["Zrotation"] - $bvh.frame[@n - 1]["RightCollar"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightCollar.bounds.center, Z_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Xrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, X_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Yrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, Y_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightUpArm"]["Zrotation"] - $bvh.frame[@n - 1]["RightUpArm"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightUpArm.bounds.center, Z_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowArm"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightLowArm"]["Xrotation"] - $bvh.frame[@n - 1]["RightLowArm"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightLowArm.bounds.center, X_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowArm"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightLowArm"]["Yrotation"] - $bvh.frame[@n - 1]["RightLowArm"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightLowArm.bounds.center, Y_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowArm"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightLowArm"]["Zrotation"] - $bvh.frame[@n - 1]["RightHand"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightLowArm.bounds.center, Z_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightHand"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightHand"]["Xrotation"] - $bvh.frame[@n - 1]["RightHand"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightHand.bounds.center, X_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightHand"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightHand"]["Yrotation"] - $bvh.frame[@n - 1]["RightHand"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightHand.bounds.center, Y_AXIS, (sa).degrees
@rightHand.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightHand"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightHand"]["Zrotation"] - $bvh.frame[@n - 1]["RightHand"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightHand.bounds.center, Z_AXIS, (sa).degrees
@rightHand.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftUpLeg.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Xrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, X_AXIS, (sa).degrees
@leftUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Yrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, Y_AXIS, (sa).degrees
@leftUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Zrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, Z_AXIS, (sa).degrees
@leftUpLeg.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftLowLeg.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Xrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, X_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Yrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, Y_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Zrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, Z_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftLowLeg"]["Xrotation"] - $bvh.frame[@n - 1]["LeftLowLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftLowLeg.bounds.center, X_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftLowLeg"]["Yrotation"] - $bvh.frame[@n - 1]["LeftLowLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftLowLeg.bounds.center, Y_AXIS, (sa).degrees
@leftLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftLowLeg"]["Zrotation"] - $bvh.frame[@n - 1]["LeftLowLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftLowLeg.bounds.center, Z_AXIS, (sa).degrees
@leftLowLeg.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@leftFoot.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Xrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, X_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Yrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, Y_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftUpLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftUpLeg"]["Zrotation"] - $bvh.frame[@n - 1]["LeftUpLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftUpLeg.bounds.center, Z_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftLowLeg"]["Xrotation"] - $bvh.frame[@n - 1]["LeftLowLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftLowLeg.bounds.center, X_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftLowLeg"]["Yrotation"] - $bvh.frame[@n - 1]["LeftLowLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftLowLeg.bounds.center, Y_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftLowLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftLowLeg"]["Zrotation"] - $bvh.frame[@n - 1]["LeftLowLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftLowLeg.bounds.center, Z_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftHand"]["Xrotation"]
else
sa = $bvh.frame[@n]["LeftHand"]["Xrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Xrotation"]
end
trans = Geom::Transformation.rotation @leftHand.bounds.center, X_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftHand"]["Yrotation"]
else
sa = $bvh.frame[@n]["LeftHand"]["Yrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Yrotation"]
end
trans = Geom::Transformation.rotation @leftHand.bounds.center, Y_AXIS, (sa).degrees
@leftFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["LeftHand"]["Zrotation"]
else
sa = $bvh.frame[@n]["LeftHand"]["Zrotation"] - $bvh.frame[@n - 1]["LeftHand"]["Zrotation"]
end
trans = Geom::Transformation.rotation @leftHand.bounds.center, Z_AXIS, (sa).degrees
@leftFoot.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightUpLeg.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Xrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, X_AXIS, (sa).degrees
@rightUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Yrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, Y_AXIS, (sa).degrees
@rightUpLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Zrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, Z_AXIS, (sa).degrees
@rightUpLeg.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightLowLeg.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Xrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, X_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Yrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, Y_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Zrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, Z_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightLowLeg"]["Xrotation"] - $bvh.frame[@n - 1]["RightLowLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightLowLeg.bounds.center, X_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightLowLeg"]["Yrotation"] - $bvh.frame[@n - 1]["RightLowLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightLowLeg.bounds.center, Y_AXIS, (sa).degrees
@rightLowLeg.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightLowLeg"]["Zrotation"] - $bvh.frame[@n - 1]["RightLowLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightLowLeg.bounds.center, Z_AXIS, (sa).degrees
@rightLowLeg.transform! trans
trans = Geom::Transformation.translation [$bvh.frame[@n]["Hips"]["Xposition"] / 4, $bvh.frame[@n]["Hips"]["Yposition"] / 4, $bvh.frame[@n]["Hips"]["Zposition"] / 4]
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Xrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Xrotation"] - $bvh.frame[@n - 1]["Hips"]["Xrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, X_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Yrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Yrotation"] - $bvh.frame[@n - 1]["Hips"]["Yrotation"]
end
@rightFoot.transform! trans
trans = Geom::Transformation.rotation @hips.bounds.center, Y_AXIS, (sa).degrees
if @n == 0
sa = $bvh.frame[@n]["Hips"]["Zrotation"]
else
sa = $bvh.frame[@n]["Hips"]["Zrotation"] - $bvh.frame[@n - 1]["Hips"]["Zrotation"]
end
trans = Geom::Transformation.rotation @hips.bounds.center, Z_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Xrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, X_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Yrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, Y_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightUpLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightUpLeg"]["Zrotation"] - $bvh.frame[@n - 1]["RightUpLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightUpLeg.bounds.center, Z_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowLeg"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightLowLeg"]["Xrotation"] - $bvh.frame[@n - 1]["RightLowLeg"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightLowLeg.bounds.center, X_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowLeg"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightLowLeg"]["Yrotation"] - $bvh.frame[@n - 1]["RightLowLeg"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightLowLeg.bounds.center, Y_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightLowLeg"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightLowLeg"]["Zrotation"] - $bvh.frame[@n - 1]["RightLowLeg"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightLowLeg.bounds.center, Z_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightHand"]["Xrotation"]
else
sa = $bvh.frame[@n]["RightHand"]["Xrotation"] - $bvh.frame[@n - 1]["RightHand"]["Xrotation"]
end
trans = Geom::Transformation.rotation @rightHand.bounds.center, X_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightHand"]["Yrotation"]
else
sa = $bvh.frame[@n]["RightHand"]["Yrotation"] - $bvh.frame[@n - 1]["RightHand"]["Yrotation"]
end
trans = Geom::Transformation.rotation @rightHand.bounds.center, Y_AXIS, (sa).degrees
@rightFoot.transform! trans
if @n == 0
sa = $bvh.frame[@n]["RightHand"]["Zrotation"]
else
sa = $bvh.frame[@n]["RightHand"]["Zrotation"] - $bvh.frame[@n - 1]["RightHand"]["Zrotation"]
end
trans = Geom::Transformation.rotation @rightHand.bounds.center, Z_AXIS, (sa).degrees
@rightFoot.transform! trans
@view.invalidate
@n = @n + 1
end
end
以上。