WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-12-2008, 10:02 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Now you're dealing with non-normalized quaternions, so all bets are off. In general, you don't need to deal with quaternions at such a low level. You can use Vizards matrix routines to deal with rotation transformations.
Reply With Quote
  #2  
Old 06-17-2008, 10:13 AM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Question

Quote:
Originally Posted by farshizzo View Post
Now you're dealing with non-normalized quaternions, so all bets are off.
Do you then know by any chance what course of action does Vizard take if you try to set an object's quaternion to [x,y,z,w] such that x^2+y^2+z^2+w^2 > 1?
For example, add this function definition to my previous code:
Code:
# Normalizes the passed quaternion (which is assumed to have the form
# [x,y,z,w]) so that the vector [x,y,z,w] has unit length.
# Note: normalization is done in place (i.e., the correct way
# of calling this function is 'normalizeQuat(q1)' rather than 'q1 = normalizeQuat(q2)'.
def normalizeQuat (quat):
	i = 0
	normFactor = 0
	while (i < len(quat)):
		normFactor += quat[i]**2
		i += 1
	normFactor = normFactor**0.5

	i = 0
	while (i < len(quat)):
		quat[i] /= normFactor
		i += 1
Now if you normalize quat [0,1,0,-1] we get the same MainView orientation as with the unnormalized quaternion. Is this behavior expected? Does a function similar to my 'normalizeQuat' get called in Vizard behind the scenes if you try to set an object's quaternion to an unnormalized one?
Quote:
Originally Posted by farshizzo View Post
In general, you don't need to deal with quaternions at such a low level. You can use Vizards matrix routines to deal with rotation transformations.
Unfortunately, seems like I do. This little script is just a way to fill in the gaps I have in my understanding of quaternions.
Reply With Quote
  #3  
Old 06-17-2008, 10:40 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Yes, Vizard will internally normalize all quaternions that are passed to the setQuat function of nodes, views, and bones.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
coalesceing euler angles epl Vizard 6 05-28-2004 05:25 PM
plug-ins that return quaternions hotspur1 Vizard 2 02-05-2004 07:47 PM


All times are GMT -7. The time now is 08:24 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC