Transform combination for rotation about arbitrary axis
I have read through many of the postings about rotations around axes other than ones going through the origin, and they list various solutions. I tried using the method where an object is translated to the origin, rotated, and then translated back to its original position.
When using this method, does each translation and rotation need to be in a separate TransformGroup, or can one TransformGroup use three Transform3D objects multiplied together to reach the same result?
Thanks for any additional info anyone can provide.
You can use only one TransformGroup with the combined transformation. However if you change something you have to recalculate the overal transformation again. Thus you have to store the translation and rotation values. If you use seperate TransformGroups Java3D is calculating the overal transformation for you. In this case: if the capability bits which allow changes to the Trasnformation are NOT set and the scene graph is compiled, then j3d will internally hold only the combined transformation, so you don't loose any performance.
Similar Messages
-
Hi all !!!
I am a novice to 3d programming but i have done some JAVA programming earlier.
The problem i am finding is that I do not know how to rotate any geometric object (say, a cylinder or a cone) about any arbitrary axis, say ax+by+c=0.
Can anybodyhelp me ???
Thanks in advance.
AjayI am pretty sure I know what you are talking about.
//Create the Object
//Create a transform group for your object
TransformGroup tg = new TransformGroup();
// Now you need to make a Transform3D to do the rotational work
Transform3D tr = new Transform3D();
//To rotate around any axis use setRotation and pass
// is a Quat4D (or f,i)
// Quat takes 4 arguments x,y,z,w use the x,y and z to
// create a vector to rotate around. i.e. (0,1,0,.4) would
// rotate arount the Y axis, (1,1,0, .4) would rotate
// around a line between x,y.
// The W in the Quat is the angle to rotate (in Radian 0-2Pi);
//So ...
tr.setRotation( new Quat4d(1,1,0,.4));
tg.setTransform(tr);
//Add your object to your transform group
tg.addChild(your_object);
//Add your TRansformGroup to the world
root.addChild(tg); //or whatever your BranchGroup is called
I hope that is what you wanted. And does what you need. -
Model rotation about multiple axis
Can anyone tell me how I can limit the rotation of a model to
a specific angle without using camera rotation?
I do know how to limit the rotation when the model has only
been rotated in one axis (simple maths comparison of either x, y,
or z depending on which axis I've rotated the model about).
But, how do you limit rotation when the model has already
been rotated about 1 or 2 of the other axes given that x, y, and z
keep changing their values and axisAngle doesn't always give
appropriate values?Using parent/childs is one way to work around relative
rotation problems. Parent the model you are trying to limit
rotation on to a dummy model (or group). Keep the dummy at
rotation(0, 0, 0), and rotate the target model to its correct
orientation in your scene. Then monitor the dummy's rotation to
keep it within your limits. -
Transformation point for rotation
Before in flashMX the transformation point of rotation was BY
DEFAULT at the 0, 0 (or point of origin) in a symbol.
This alone left the use of rotation in tweening fluent and
easy but now in Flash 8 professional, it as the weird tendancy to
center itself BY DEFAULT and returning to 0,0 only if I start a
transformation and double-click on the transformation point.
I want to know how I can BY DEFAULT put this transformation
point to 0,0 because this is increasingly annoying when you have a
lot of symbol to work with.
Thank youOmniFlash,
> but now in Flash 8 professional, it as the weird
tendancy to
> center itself BY DEFAULT and returning to 0,0 only if I
start
> a transformation and double-click on the transformation
point.
When you convert shapes or images to a symbol, you'll see a
3x3 square
filled with 9 tiny squares. These allow you to determine the
default
registration point for that particular symbol. The convert
dialog will
remember settings from last time, so if you click the
upper-left square
once, you'll be set.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Rotation around an arbitrary axis in Flex
I am hoping to animate the rotation of an object around an arbitrary axis. Is it possible to do this with the animation classes in Flex 4? I can get it to work using the Rotate3D function, but only around the x-, y- or z-axis. I'll explain... I have objects that are subclasses of FilledElements, because I need them to be filled with bitmaps. These elements are created using drawPath, because they can be any type of polygon in the xy plane. I need to be able to "flip" an object, using any one of its sides as an axis. The "flip" is a 3D rotation. The flip works for a rectangle whose width is parallel to the x-axis or length is parallel to the y-axis. But, if I have a triangle or other polygon whose sides are not parallel to any axes? How can I generate a 3D rotation on one of its sides?
I tried setting different values using SimpleMotionPath on the transform property. I tried using the animation class, but it needs a property, and I'm not sure what property maps to what I need. I thought changing the transform property using SimpleMotionPath might work, but that doesn't do it. I have tried using matrix.appendRotation on the object, but I'm not sure how to animate using that function.
Thanks! Any help would be appreciated.It is not the spheres I am worried about in this instance. I can move the spheres as I need to however, there are linking cylinders between those spheres. I easily find the midpoint for the cylinder to be located at but the cylinder needs to be aligned so it is pointing to the central sphere and the external sphere. That is what the above code is trying to generate, a matrix4d transform that rotates and aligns the cylinder along the direction required.
Cheers
Mark -
Hi,
I found an interesting tutorial (link) and created a working model, adapting it as needed.
So far, when I center the container sprite and rotate it, it appears to first rotate from a 0,0 registration point, instead of from its center. I've tried to changet he sprite's registration point, but so far this hasn't worked/helped. Nothing else has worked to fix this rotation problem.
I must be doing something wrong.
Here's the AS3 (to view, add to first frame of new FLA, 1024X768 stage, color black). Rotation segments below are commented as //ROTATION.:
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.text.TextField;
//import flash.geom.ColorTransform;
stop();
//public class bejewelled extends Sprite {
var gems_array:Array=new Array();
var aGem:Sprite;
var selectorBox:Sprite=new Sprite();
var selectorRow:int=-10;
var selectorColumn:int=-10;
var red:uint = 0xFF0000;
var green:uint = 0xFF00;
var blue:uint = 0xFF;
var yellow:uint = 0xFFFF00;
var cyan:uint = 0xFFFF;
var magenta:uint = 0xFF00FF;
var white:uint = 0xFFFFFF;
var colours_array:Array=new Array(red,green,blue,yellow,cyan,magenta,white);
var clickPossible:Boolean=false;
var score_txt:TextField=new TextField();
var hint_txt:TextField=new TextField();
var score:uint=0;
var inaRow:uint=0;
var match:Boolean = true;
var gemSize:uint = 96;
var format:TextFormat = new TextFormat();
var rotate:Boolean=false;
var container:Sprite = new Sprite(); // Create the container sprite
//var newColorTransform:ColorTransform = exitBtn.transform.colorTransform;
//newColorTransform.color = 0xff0000;
//exitBtn.transform.colorTransform = newColorTransform;
function bejewelled() {
// Game initiation
format.size = 40;
format.font = 'Arial';
// Create and style score text
addChild(score_txt);
score_txt.textColor=0xFFFFFF;
score_txt.x=gemSize*9.6;
score_txt.autoSize = TextFieldAutoSize.LEFT;
score_txt.defaultTextFormat = format;
// Create and style hint text
addChild(hint_txt);
hint_txt.textColor=0xFFFFFF;
hint_txt.x=gemSize*9.6;
hint_txt.y=gemSize;
hint_txt.autoSize = TextFieldAutoSize.LEFT;
hint_txt.defaultTextFormat = format;
// Create Gems in rows and columns
addChild(container); // Add the container to the display list (stage)
for (var i:uint=0; i<8; i++) {
gems_array[i]=new Array();
for (var j:uint=0; j<8; j++) {
do {
gems_array[i][j]=Math.floor(Math.random()*7);
while (rowLineLength(i,j)>2 || columnLineLength(i,j)>2);
aGem=new Sprite();
aGem.graphics.beginFill(colours_array[gems_array[i][j]]);
aGem.graphics.drawCircle(gemSize/2,gemSize/2,gemSize/2.07);
aGem.graphics.endFill();
aGem.name=i+"_"+j;
aGem.x=j*gemSize;
aGem.y=i*gemSize;
container.addChild(aGem);
//Center the container sprite
container.width = container.width - 10;
container.height = container.height - 10;
container.x = (stage.stageWidth-container.width)/2;
container.y = (stage.stageHeight-container.height)/2;
// Create and style selector box
container.addChild(selectorBox);
selectorBox.graphics.lineStyle(2,red,1);
selectorBox.graphics.drawRect(0,0,gemSize,gemSize);
selectorBox.visible=false;
// Listen for user input
container.addEventListener(MouseEvent.CLICK,onClick);
addEventListener(Event.ENTER_FRAME,everyFrame);
// Every frame...
function everyFrame(e:Event):void {
//Assume that gems are not falling
var gemsAreFalling:Boolean=false;
// Check each gem for space below it
for (var i:int=6; i>=0; i--) {
for (var j:uint=0; j<8; j++) {
// If a spot contains a gem, and has an empty space below...
if (gems_array[i][j] != -1 && gems_array[i+1][j]==-1) {
// Set gems falling
gemsAreFalling=true;
gems_array[i+1][j]=gems_array[i][j];
gems_array[i][j]=-1;
trace("#");
trace(i+"_"+j);
container.getChildByName(i+"_"+j).y+=gemSize;
container.getChildByName(i+"_"+j).name=(i+1)+"_"+j;
break;
// If a gem is falling
if (gemsAreFalling) {
// don't allow any more to start falling
break;
// If no gems are falling
if (! gemsAreFalling) {
// Assume no new gems are needed
var needNewGem:Boolean=false;
// but check all spaces...
for (i=7; i>=0; i--) {
for (j=0; j<8; j++) {
// and if a spot is empty
if (gems_array[i][j]==-1) {
// now we know we need a new gem
needNewGem=true;
// pick a random color for the gem
gems_array[0][j]=Math.floor(Math.random()*7);
// create the gem
aGem=new Sprite();
aGem.graphics.beginFill(colours_array[gems_array[0][j]]);
aGem.graphics.drawCircle(gemSize/2,gemSize/2,gemSize/2.07);
aGem.graphics.endFill();
// ID it
aGem.name="0_"+j;
// position it
aGem.x=j*gemSize;
aGem.y=0;
// show it
container.addChild(aGem);
// stop creating new gems
break;
// if a new gem was created, stop checking
if (needNewGem) {
break;
// If no new gems were needed...
if (! needNewGem) {
// assume no more/new lines are on the board
var moreLinesAvailable:Boolean=false;
// check all gems
for (i=7; i>=0; i--) {
for (j=0; j<8; j++) {
// if a line is found
if (rowLineLength(i,j)>2 || columnLineLength(i,j)>2) {
// then we know more lines are available
moreLinesAvailable=true;
// creat a new array, set the gem type of the line, and where it is
var lineGems:Array=[i+"_"+j];
var gemType:uint=gems_array[i][j];
var linePosition:int;
// check t's a horizontal line...
if (rowLineLength(i,j)>2) {
// if so, find our how long it is and put all the line's gems into the array
linePosition=j;
while (sameGemIsHere(gemType,i,linePosition-1)) {
linePosition--;
lineGems.push(i+"_"+linePosition);
linePosition=j;
while (sameGemIsHere(gemType,i,linePosition+1)) {
linePosition++;
lineGems.push(i+"_"+linePosition);
// check t's a vertical line...
if (columnLineLength(i,j)>2) {
// if so, find our how long it is and put all the line's gems into the array
linePosition=i;
while (sameGemIsHere(gemType,linePosition-1,j)) {
linePosition--;
lineGems.push(linePosition+"_"+j);
linePosition=i;
while (sameGemIsHere(gemType,linePosition+1,j)) {
linePosition++;
lineGems.push(linePosition+"_"+j);
// for all gems in the line...
for (i=0; i<lineGems.length; i++) {
// remove it from the program
container.removeChild(container.getChildByName(lineGems[i]));
// find where it was in the array
var cd:Array=lineGems[i].split("_");
// set it to an empty gem space
gems_array[cd[0]][cd[1]]=-1;
// set the new score
score+=inaRow;
// set the score setter up
inaRow++;
// if a row was made, stop the loop
break;
// if a line was made, stop making more lines
if (moreLinesAvailable) {
break;
// if no more lines were available...
//ROTATION
if (! moreLinesAvailable) {
if(rotate){
container.rotation+=5;
if(container.rotation%90==0){
rotate=false;
container.rotation=0;
rotateClockwise(gems_array);
while(container.numChildren>0){
container.removeChildAt(0);
for (i=0; i<8; i++) {
for (j=0; j<8; j++) {
aGem=new Sprite();
aGem.graphics.beginFill(colours_array[gems_array[i][j]]);
aGem.graphics.drawCircle(gemSize/2,gemSize/2,gemSize/2.07);
aGem.graphics.endFill();
aGem.name=i+"_"+j;
aGem.x=j*gemSize;
aGem.y=i*gemSize;
container.addChild(aGem);
container.addChild(selectorBox);
selectorBox.graphics.lineStyle(2,red,1);
selectorBox.graphics.drawRect(0,0,gemSize,gemSize);
selectorBox.visible=false;
else{
// allow new moves to be made
clickPossible=true;
// remove score multiplier
inaRow=0;
// display new score
score_txt.text=score.toString();
// When the user clicks
function onClick(e:MouseEvent):void {
// If a click is allowed
if (clickPossible) {
// If the click is within the game area...
if (mouseX<container.x+gemSize*8 && mouseX>0 && mouseY<container.y+gemSize*8 && mouseY>0) {
// Find which row and column were clicked
var clickedRow:uint=Math.floor((mouseY-container.y)/gemSize);
//var clickedRow:uint=Math.floor(e.target.y/gemSize);
var clickedColumn:uint=Math.floor((mouseX-container.x)/gemSize);
//var clickedColumn:uint=Math.floor(e.target.x/gemSize);
// Check if the clicked gem is adjacent to the selector
// If not...
if (!(((clickedRow==selectorRow+1 || clickedRow==selectorRow-1)&&clickedColumn==selectorColumn)||((clickedColumn==selectorColumn+1 || clickedColumn==selectorColumn-1) && clickedRow==selectorRow))) {
// Find row and colum the selector should move to
selectorRow=clickedRow;
selectorColumn=clickedColumn;
// Move it to the chosen position
selectorBox.x=gemSize*selectorColumn;
selectorBox.y=gemSize*selectorRow;
// If hidden, show it.
selectorBox.visible=true;
// If it is not next to it...
else {
// Swap the gems;
swapGems(selectorRow,selectorColumn,clickedRow,clickedColumn);
// If they make a line...
if (rowLineLength(selectorRow,selectorColumn)>2 || columnLineLength(selectorRow,selectorColumn)>2||rowLineLength(clickedRow,clickedColumn)>2 || columnLineLength(clickedRow,clickedColumn)>2) {
// remove the hint text
hint_txt.text="";
// dis-allow a new move until cascade has ended (removes glitches)
clickPossible=false;
// move and rename the gems
container.getChildByName(selectorRow+"_"+selectorColumn).x=e.target.x;//clickedColumn*gemSize;
container.getChildByName(selectorRow+"_"+selectorColumn).y=e.target.y;//clickedRow*gemSize;
container.getChildByName(selectorRow+"_"+selectorColumn).name="t";
container.getChildByName(clickedRow+"_"+clickedColumn).x=selectorColumn*gemSize;
container.getChildByName(clickedRow+"_"+clickedColumn).y=selectorRow*gemSize;
container.getChildByName(clickedRow+"_"+clickedColumn).name=selectorRow+"_"+selectorColumn;
container.getChildByName("t").name=clickedRow+"_"+clickedColumn;
match = true;
rotate = true;
// If not...
else {
// Switch them back
swapGems(selectorRow,selectorColumn,clickedRow,clickedColumn);
match = false;
if (match) {
// Move the selector position to default
selectorRow=-10;
selectorColumn=-10;
// and hide it
selectorBox.visible=false;
else {
// Set the selector position
selectorRow=clickedRow;
selectorColumn=clickedColumn;
// Move the box into position
selectorBox.x=gemSize*selectorColumn;
selectorBox.y=gemSize*selectorRow;
match = false;
// If hidden, show it.
selectorBox.visible=true;
// If the click is outside the game area
else {
// For gems in all rows...
for (var i:uint=0; i<8; i++) {
// and columns...
for (var j:uint=0; j<8; j++) {
// if they're not too close to the side...
if (i<7) {
// swap them horizontally
swapGems(i,j,i+1,j);
// check if they form a line
if ((rowLineLength(i,j)>2||columnLineLength(i,j)>2||rowLineLength(i+1,j)>2||columnLineLength(i+1,j)>2)) {
// if so, name the move made
selectorBox.x = j*gemSize;
selectorBox.y = i*gemSize;
selectorBox.visible = true;
hint_txt.text = (i+1).toString()+","+(j+1).toString()+"->"+(i+2).toString()+","+(j+1).toString();
// swap the gems back
swapGems(i,j,i+1,j);
// then if they're not to close to the bottom...
if (j<7) {
// swap it vertically
swapGems(i,j,i,j+1);
// check if it forms a line
if ((rowLineLength(i,j)>2||columnLineLength(i,j)>2||rowLineLength(i,j+1)>2||columnLineLength(i,j+1)>2) ) {
// if so, name it
selectorBox.x = j*gemSize;
selectorBox.y = i*gemSize;
selectorBox.visible = true;
hint_txt.text = (i+1).toString()+","+(j+1).toString()+"->"+(i+1).toString()+","+(j+2).toString();
// swap the gems back
swapGems(i,j,i,j+1);
//Swap given gems
function swapGems(fromRow:uint,fromColumn:uint,toRow:uint,toColumn:uint):void {
//Save the original position
var originalPosition:uint=gems_array[fromRow][fromColumn];
//Move original gem to new position
gems_array[fromRow][fromColumn]=gems_array[toRow][toColumn];
//move second gem to saved, original gem's position
gems_array[toRow][toColumn]=originalPosition;
//Find out if there us a horizontal line
function rowLineLength(row:uint,column:uint):uint {
var gemType:uint=gems_array[row][column];
var lineLength:uint=1;
var checkColumn:int=column;
//check how far left it extends
while (sameGemIsHere(gemType,row,checkColumn-1)) {
checkColumn--;
lineLength++;
checkColumn=column;
//check how far right it extends
while (sameGemIsHere(gemType,row,checkColumn+1)) {
checkColumn++;
lineLength++;
// return total line length
return (lineLength);
//Find out if there us a vertical line
function columnLineLength(row:uint,column:uint):uint {
var gemType:uint=gems_array[row][column];
var lineLength:uint=1;
var checkRow:int=row;
//check how low it extends
while (sameGemIsHere(gemType,checkRow-1,column)) {
checkRow--;
lineLength++;
//check how high it extends
checkRow=row;
while (sameGemIsHere(gemType,checkRow+1,column)) {
checkRow++;
lineLength++;
// return total line length
return (lineLength);
function sameGemIsHere(gemType:uint,row:int,column:int):Boolean {
//Check there are gems in the chosen row
if (gems_array[row]==null) {
return false;
//If there are, check if there is a gem in the chosen slot
if (gems_array[row][column]==null) {
return false;
//If there is, check if it's the same as the chosen gem type
return gemType==gems_array[row][column];
//ROTATION
function rotateClockwise(a:Array):void {
var n:int=a.length;
for (var i:int=0; i<n/2; i++) {
for (var j:int=i; j<n-i-1; j++) {
var tmp:String=a[i][j];
a[i][j]=a[n-j-1][i];
a[n-j-1][i]=a[n-i-1][n-j-1];
a[n-i-1][n-j-1]=a[j][n-i-1];
a[j][n-i-1]=tmp;
bejewelled();
Any help appreciated.OK, way too much code. By default, everything will rotate from top left. If you want to change that you need to change the positions of the content within the container, not the container itself.
For example if you do something like this:
var a:Sprite = new Sprite(); //container
addChild(a);
a.x = 100; a.y = 100;
var b:MovieClip = new car(); //clip from library
a.addChild(b);
addEventListener(Event.ENTER_FRAME, up);
function up(e:Event):void
a.rotation += 1;
The car added to the container will rotate about it's top left point... because that's where the container rotates about. To fix, move the car so the containers top/left is at the car's center like so:
var a:Sprite = new Sprite();
addChild(a);
a.x = 100; a.y = 100;
var b:MovieClip = new car();
a.addChild(b);
b.x -= b.width / 2;
b.y -= b.height / 2;
addEventListener(Event.ENTER_FRAME, up);
function up(e:Event):void
a.rotation += 1;
You'll notice all that changed is moving the car 1/2 it's width and height.
HTH -
How to get Final Transform value for a 3DLayer after Camera is applied?
Hi,
I need to export final transform values (position, rotation, scale, etc) from a Layer. I used ProjDumper example to extract the values. But I'm having trouble if the Layer is a 3D Layer and there is a Camera, because the Camera will affect the 3D Layer and hence transform it.
For example, the initial position of a Layer is in the centre of the screen (let say position 100,100). But after I adds a Camera and change the Camera properties, the Layer is seen on the top left on the screen (0,0).
So given a Layer and a Camera, how can I get the final transform values of the Layer? In other words, how can I transform from Composition coordinate to Camera coordinate?
Thanks,
KlarindaHi Brooce,
Given the Footage-type 3D Layer A & time T, I've tried the following combinations:
AEGP_GetLayerToWorldXformFromView(A, T, T, transformMatrix)
AEGP_GetLayerToWorldXformFromView(A, 0, T, transformMatrix)
AEGP_GetLayerToWorldXformFromView(A, T, 0, transformMatrix)
but they are all giving the same value as
AEGP_GetLayerToWorldXform(A, T, transformMatrix).
I've tried to change the Camera properties (focal length, zoom, etc) but AEGP_GetLayerToWorldXformFromView always gives the same value regardless of the Camera properties.
I also tried to put in the Camera Layer instead of footage-type Layer to the function, but the result of AEGP_GetLayerToWorldXformFromView is always the same as GetLayerToWorldXform, and the Camera properties doesn't affect the AEGP_GetLayerToWorldXformFromView function.
So my question is, why the AEGP_GetLayerToWorldXformFromView is not affected by Camera and why does it always give same result as AEGP_GetLayerToWorldXform?
Thanks. -
I have a script that creates geologic map symbols, positions them, and rotates them into their proper orientation. However, I do not know how to rotate about a specific point (not the center of the group). The portion of script in question is:
if (dlg.symbol.bedding.value) {
var myLine = stGroup.pathItems.add();
myLine.stroked = true;
myLine.setEntirePath([[posx,posy],[posx+3,posy]]);
myLine.strokeWidth = .75;
var myLine = stGroup.pathItems.add();
myLine.setEntirePath([[posx,posy - 6.75],[posx,posy + 6.75]]);
myLine.stroked = true;
myLine.strokeWidth = .75;
stGroup.rotate(-azi);
and I wish to rotate around the point [posx, posy]. How do I accomplish this?Thanks! That worked. For future reference, here's the modified section of script:
if (dlg.symbol.bedding.value) {
var myLine = stGroup.pathItems.add();
myLine.stroked = true;
myLine.setEntirePath([[posx,posy],[posx+3,posy]]);
myLine.strokeWidth = .75;
var myLine = stGroup.pathItems.add();
myLine.setEntirePath([[posx,posy - 6.75],[posx,posy + 6.75]]);
myLine.stroked = true;
myLine.strokeWidth = .75;
mapDoc.theOrigin = mapDoc.rulerOrigin;
mapDoc.rulerOrigin = [posx,posy];
stGroup.rotate(-azi, undefined,undefined,undefined,undefined,Transformation.DOCUMENTORIGIN);
mapDoc.rulerOrigin = mapDoc.theOrigin;
Another parameter in the rotate method to specify a rotation point would be nice. Still, this works just fine, so no complaints from me. -
Animate a cube to rotate around x axis!!!
Hi! I'm trying to animate a cube to rotate around x axis using RotationInterpolator object.
Can anyone kindly tell me how I can do that? I've seen the example at Sun's 3d tutorial but they use the default behavior which is rotating around y axis.
Thanks in advance.
--DMlol
in fact the axis used in the RotationInterpolator is the one which is on the y axis in the local coordinates system obtained after the Transform3D is performed
for example:
- if you use only new Transform3D(), which does nothing, the axis will be y
- but if you use rotz(), this transform3D transforms the old x axis into the new y one, the old y axis into the new -x one and the old z axis into the new z one. Thus in the new local coordinates system obtained, the new y axis matches the old x axis, so this x axis is used for the interpolator
I don't know if I'm very clear, it's difficult to explain and I'm French ;)
see the java 3D API :
http://java.sun.com/products/java-media/3D/forDevelopers/J3D_1_3_API/j3dapi/javax/media/j3d/RotationInterpolator.html#RotationInterpolator(javax.media.j3d.Alpha, javax.media.j3d.TransformGroup, javax.media.j3d.Transform3D, float, float) -
Hello all,
I am using the IMAQ Match Pattern 4 to detect the rotation angle of a template image. However, it shows the error: "Error 1074395241: The template descriptor does not contain data required for rotation-invariant matching." What is the problem exactly? How to solve this? The details are explained below.
My project is a little bit complicated. Part of the block diagram containing the IMAQ Match Pattern 4 is shown below:
The source image is a series of frames of images read from an AVI video (I used a for loop to process the images frame by frame). The template image is a selected region of the first frame. So it means, the user selected the object of ineterst in the first frame of the video, and in each of the following frames, we need to find the matched object of interest & determine its rotation angle. When I run the block diagram shown above, it does not have any error. However, it shows the rotation angle as zero no matter what it "really" is. Therefore, I changed the block diagram by adding the parameters, shown below:
But in this case, when I run it, it shows the error that I have indicated in the subject line.
If you need more details about my project to identify the problem, please let me know.
Thanks in advance.
Solved!
Go to Solution.-Please go through pattern matching example which comes along with labview fiirst
Go to labview Help>>Find Examples and you can search for example.
-You have create template with angle range and what type of pattern matching you want use.
-For this you have to use IMAQ Learn Pattern before using IMAQ Match Pattern 4
Refer :http://zone.ni.com/reference/en-XX/help/370281U-01/imaqvision/imaq_match_pattern_4/
Thanks
uday,
Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
Certified LabVIEW Associate Developer (CLAD) Using LV13 -
How to add a feild as key combination for existing condition table
Hi all,
please any body can inform me about how to add a feild as key combination for existing condition table ex 901 having the key combination of sales organisation and material
for this cond. table,how to add a new feild ex:price list
iam unable to add it in change mode of v/03.(even after removing this 901 table from Acc.seq.)
Edited by: rajendraprasad vasam on Apr 25, 2008 10:08 AMmr.Rajendra
I you have the access key - you can copy the 901 table and create a new table along with your required field. v/03
Or
in the access sequence for the condition type - add 1 more step and add your field.
ie 10 - 901
and in 20 - your required field
regards,
Reshmi
Edited by: reshmi bhaskar on Apr 25, 2008 10:21 AM -
Another Question...rotating on two axis
Hi again. Well I have yet another question...how do I set a translation to rotate on two axis? Like I know that I can do:
TransformGroup tg;
Transform3D t3d = new Transform3D();
t3d.setRotation(new AxisAngle4f(1f,0f,0f,(some angle)));
tg.setTransform(t3d);
for one axis (I just put the declarations in to show an example) but if I try to apply two set rotations or two Transform3D's it doesn't work...so how would I rotate on, say, both the x and the y axis? Thanks,
Compaqin fact the best thing would be to get used to quaternions. I suppose some Java3D tutorials discribe it quite well.
If you really want to use rotation on axis you have two solutions :
create 2 Transform3D and apply the result
Transform3D t3dx = new Transform3D();
t3dx.setRotation(new AxisAngle4f(1f,0f,0f,(xangle)));
Transform3D t3dy = new Transform3D();
t3dy.setRotation(new AxisAngle4f(0f,1f,0f,(yangle)));
t3dx.mul(t3dy);
tg.setTransform(t3dx);
(hum, at least i suppose it would work ;)
or you can do that too :
Transform3D t3dx = new Transform3D();
t3d.setRotation(new AxisAngle4f(1f,yangle/xangle,0f,(xangle)));
tg.setTransform(t3d);
(in this case xangle must be != 0)
I'm not really sure it will work so please tell me if it works. I've tried to help you twice today so you can send me some bucks to the folowing address :
oh, ok mum i won't give our address on the internet ;)
c ya
GnG -
[svn] 4803: Fix bug SDK-18434 Bounds for rotated rounded rect is incorrect
Revision: 4803
Author: [email protected]
Date: 2009-02-02 16:06:34 -0800 (Mon, 02 Feb 2009)
Log Message:
Fix bug SDK-18434 Bounds for rotated rounded rect is incorrect
Fix: Calculate the bounds of the transformed corner ellipses in the case of matrix transformation. Refactor the Ellipse's helper method and move it to MatrixUtil.as so that it's shared between classes.
QE Notes: None
Doc Notes: None
Bugs: SDK-18434
Reviewer: Ryan
tests: checkintests, mustella gumbo/layout/graphicelement
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-18434
http://bugs.adobe.com/jira/browse/SDK-18434
Modified Paths:
flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/Ellipse.as
flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/Rect.as
flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/MatrixUtil.as -
I don't know how it happened why, but the icon for rotation lock is missing from the control bar. Second problem, the passcode for my iPad isn't working. I wrote it down, so not sure what the problem is. HELP
If the setting for the rotation lock is missing it is because you are using the side switch to control the rotation in Settings>General>Use Side Switch to>Lock Rotation. The software switch in the control center should be for Muting system sounds.
you have to restore the iPad in orde to unlock it now.
iOS: Forgotten passcode or device disabled after entering wrong ...
If you are sure that you are entering the correct passcode, reboot the iPad and then try again and see if it is accepted.
Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up. -
Deleted CVC's combination for product
Hi experts,
My User has deleted the CVC's combination for one product in APO. He is asking me load the deleted data by tracing in ECC.How can we trace out the Product Hierarchy in ECC for the Product. Please help me.
Thanks,
ManasaHi Manasa,
Assuming that the user has deleted the CVCs only in the planning area, I have the following possible options:
1) Do you take backup of data from planning area? If yes, go to the backup cube, and you can find all the CVCs correspodning to the product. Create CVCs using the backup cube. Then load the data from the backup cube to the planning area (by using this material as selection criteria). Most likely you would be able to recover all the lost CVCs/Key Figures in this way (Depends on what kind of backup you take).
2) If you are not taking a backup (I would be very surprsied if this is the case), your task might not be easy. Talk to your BW team. They would be either sending the history data relevant for creation of CVC, or they might also be extracting data from DP planning area for reporting purpose. Either ways, it might be easy to identify the CVCs based on data available in BW system.
Next would come the issue of how to get the Key Figures data against the CVCs. It could be simple or complex depending on your design. I can't directly comment. May be you can get history data easily from BW, and then run the DP jobs in APO to do the relevant calculation, or otherwise wait for the already scheduled DP jobs to run and they would take care of DP related calculations. Be very careful about this part - you would need to understand your DP flow properly before taking any actions.
3) You could try to identify the missing CVCs in R/3 by understanding what all characteristics you use in DP, and how you derive them during creation of CVC. Again you could try to identify how you would get the Key Figures against the CVCs from R/3 to APO. Again, my guess is that these calculations should mostly happen in BW, so above option no. 2 should hold good, but depends on your design. If you are not using BW to get data for DP, your situation could be very tricky.
PS: If backup is taken (option 1), that is the simplest and straight forward option for you, go for it. Otherwise, best of luck.
Thanks - Pawan
Maybe you are looking for
-
I have set up my iCloud email address on my iPhone and iMac but it does not appear in my iPad? Any suggestions?
-
JDAPI Error: ORA-04020: deadlock detected while trying to lock object
I have written a JDAPI program to perform read-only impact analysis and report any problems. The following error is occurring: "A deadlock among DDL and parse locks is detected. This deadlock is usually due to user errors in the design of an applicat
-
Connecting nano to a hifi?
Can you buy a cable for connecting an ipod nano to output to a hifi as you can with an ipod?
-
sir, is it possible to make a JTable cell Editable false by using Default table model if it possible please tell me how?. Is it posible to make report in java if so which Api cxan be used?. thanks
-
ORA-23313 - DBMS_REPCAT.CREATE_MASTER_REPGROUP
Hi I have a DEV database (db_name=DEV, instance_name = DEV, global_names=TRUE ) which was created from the backup of the database PROD. I am trying to implement replication between DEV and another database TEST. When I try creating the master group a