VTK move image to center of the bounding box - vtk

How can I move my image which is in the bottom left of the bounding box to center of the box? Also I want to maximize the size of the image that fits to the bounding box.

What do you mean by "bounding box"? If you are using a vtkImageSlice, you can just use SetPosition(-width/2, -height/2, 0).

Related

How to check if ellipse is outside background Image drawn with Fabric.js

I can always check by looking at the co-ordinates and comparing with Image, of ellipse shape, but it fails when ellipse is at the corner.
I have tried using intersectWith method, it only works with bounding box, not the actual border of the shape.
This is the scenario I need it to work to be able to check if ellipse is outside of the background Image, not. bounding box.

VTK: small cosy in a corner instead of the middle

Is it possible to have the vtkAxesActor small in a corner of the window?
Here is a image of what I currently got and what I would like to have. The colorful axes are the standard axesActor. But I would like the axes in a corner of the window and only there (bottom left in black). They shouldn't move around the window when the view is rotated. Only around their origin.
Is this possible? And if yes, how?
A possible solution is to put the vtkAxesActor into an orientation widget:
widget = vtk.vtkOrientationMarkerWidget()
widget.SetOrientationMarker(axisActor)
widget.SetInteractor(interactor)
widget.SetViewport(0, 0, size, size)
widget.InteractiveOff()
widget.EnabledOn()
The vtkAxesActor location is functional and it's location has a purpose. The anchor point of the AxesActor is the anchor point of the model. This provides context of where any transformations or translations would be calculated from.
Unfortunately the example of the axisActor in the corner you have proposed would only provide context of the orientation of the model and so not part of the standard options.

How do I create the center of TouchScreenButton texture in the center of the TouchScreenButton position along with it's shape?

So, if I create a button using TouchScreenButton and assign a texture to it, the texture will be displayed on the left bottom of the TouchScreenButton position (See image below)
The TouchScreenButton position is in the top left corner of the rectable
When I don't assign a texture and instead I create a sprite as the child node and assign a texture to it, it will display the texture in the center of TouchScreenButton.
But the shape is still follows what I have said earlier.
My question, How do I create the center of TouchScreenButton texture in the center of the TouchScreenButton position along with it's shape? I want the TouchScreenButton is in the middle of the TouchScreenButton texture.
Solution 1. Go to your Sprite node and in the inspector disable Centered property in the offset section. This way though you should keep sprite and shape sizes for centers of the area and the texture to match, coz now both the Sprite and Shape will be to the right bottom of the origin coordinates of the button.
Solution 2. Go to your TouchScreenButton node and in the inspector enable Shape Centered property in the main section. This way you will make both the shape and the sprite to be centered in the origin of the button.

Updating the alignment box in Visio

I have created a master shape which is a small rectangle. I used the code to extract the coordinates from a *.CSV file, made the master shape to be dropped on the page and apply those coordinated to it. As it turns out that the final shape is much larger than the initial master shape I created. My problem is the alignment box that surrounds the shape, for resize and rotation, is still the same small size as it was in the original shape. Is it possible to make the alignment box reset to the new shape?
Here is an image. The gray area is the new shape. The wire like rectangle is the alignment box of master shape. The top image shows the gray area as the new shape and the tiny wire like alignment box in the lower left corner of the shape. This is how it comes out.
What I want is shown in the second image. The alignment box should cover the entire shape and not just the tiny lower left corner.
How do I make the alignment box to cover the entire shape?
How do I get this to work? Any thoughts?
As always, any help is appreciated.
Thank you!
-Miki
Ok, I found the solution to this question via Visioguy forum and I am posting the answer here so that incase someone might end up here trying to find the same thing.
In Visio, there is a function called, "Update Alignment Box". I used that function and added a line to my code to do it programmatically.
Here is the line:
activewindow.selection.updatealignmentbox
-Miki

SVG: how to position bounding box of rotated text

I have to build a SVG image containing some rotated text elements. I want to achieve the following:
Each text element shall be rotated around its center point by a degree.
The resulting (imaginary) bounding box of the rotated text shall be translated, so that it's upper left is at position x,y.
We don't know the content, i.e., the width, of the text elements beforehand.
What is the best way to do that?
(I have a basic understanding of SVG and I am able to look up the spec on my own. So I know about transform and rotate(), translate()... However, I struggle with this specific case.)

Resources