Change the origin to the center of object in Google SketchUp(Free version) - axes

As shown in the following, I am trying to move the origin to the center of the bounding box of this 3D object by using its Axes tool. At a result, it seems very hard to find that center because there is not auto-snap to help me move the axes. I am using the free version of Google SketchUp 8 and I do find some handy source code like plug-in to do this for me in Pro version which I don't have.
Could anyone tell know how to perform this to set the origin to the center?

(What plugin did you find that did this only in Pro?)
I happen to have a plugin that does this: http://sketchucation.com/forums/viewtopic.php?t=30508
If you want to do this yourself by code, then the gist of it is:
Get the point for the new origin of the axes. instance.bounds.center
Get the vector from the new origin to the old origin.
In the definition of the group or component, transform all the content using the vector.
For each instance belonging to the definition, apply the inverse transformation.

Related

ARKit + Core location - points are not fixed on the same places

I'm working on developing iOS AR application using ARKit + Core location. And the points which are displayed on the map using coordinates move from place to place when I go. But I need they are displayed on the same place.
Here you can see the example of what I mean:
https://drive.google.com/file/d/1DQkTJFc9aChtGrgPJSziZVMgJYXyH9Da/view?usp=sharing
Could you help to handle with this issue? How can I have fixed places for points using coordinates? Any ideas?
Thanks.
Looks like you attach objects to planes. However, when you move the ARKit extends the existing planes. As a result if you put points, for example, at the center of the plane, then the center is always updated. You need to recalculate the coordinates of the point and place objects correctly.
The alternative is not to add objects to planes (or in relation to them). If you need to "put" object on a plane, then the best way is to wait, until the plane will be directed enough (it will not change his direction significantly if you will move), then select a point on the plane where you want to put your object, then convert this point coordinate to global coordinates (as a result if plane will change his size the coordinate you have will not be changed at all), and finally put object in root (or another object that it's not related to the plane).

ARKit - Update only the world coordinates origin

Once the user has scanned the environment and that I detected a plane, I would like the world origin anchor, which is the device position when the app opens (which is the origin of the 3D world), to be reset to where my device is right now so that the user can see my AR objects in front of him.
(my objects are floating and not related to the floor but detecting a plane makes the objects more stable)
I didn't find a way to do that. It's linked to ARConfiguration but it doesn't seem like we can update the coordinate system without resetting all the tracking. Do you have any idea?
According to this post link, the documentation of the rootNode says:
You should not modify the transform property of the root node.
I still tried affecting the camera position to the position of the rootNode but it didn't change anything.
So it seems like the only way is to create a new node and use it as a rootNode from where we are.

Get real coordinates of Point (or any other constructed object)

In GeoGebra, you can easily construct scenes with the GUI and the tools available in the Graphics view. I now have two functions and created some objects around them using that tools (Their intersection point, a circle tangent to both etc.). The whole depends on 5 parameters I defined as sliders for testing.
Now I want to know the coordinates of the point. It is defined as Intersect[l, h] which doesn't help me. I can access its coordinates too (0.8, 3.98) but I want to know how to calculate them depending on the parameters. (I'd expect it to be something like (3a, 7+b-2a)). I know GeoGebra can do this because it must have done it internally to be able to draw the whole image. But I don't know how to access this information.
If you want to get the current position of a Point P you can use the x and y commands. These will update whenever the position of P changes so that you don't have to recalculate where the point should be by hand.

Viewpoint for X3D Centering

Can anyone please help me in calculating center of rotation and position of a X3D object?
I've noticed that aopt tool by InstantReality adds something like:
<Viewpoint DEF='AOPT_CAM' centerOfRotation='x y z' position='x y z'/>
The result is nice, object is properly zoomed, centrated and center
of rotation is somehow perfectly "inside" the object (x,y,z, center).
I must avoid using aopt, how can I obtain that, (i.e. via JavaScript)
pheraphs looping trough XML Coordinate point and doing some calculations...?
I'm using X3DOM to render the object.
Many thanks.
"AOPT_CAM" is the name of the Viewpoint. The centerOfRotation and position values are automatically computed by the Browser (InstantReality in your case).
In order to compute these values by yourself you need to know your object size (BoundingBox) and do some math to compute where the Viewpoint should be located ('position' attribute) in your local coordinate system. You also need to know the object displacement in the coordinate system. If not specified this should be (0,0,0)

What does body.GetPosition,body.GetWorldCenter stand for in Box2D?

Recently I have a new project that uses Box2D as physics engine. And I am having some trouble with the body's position.
I want to draw images on the sprite, so I just use body.GetPosition as image's position. But I found that body.GetPosition returns the same value as body.GetWorldCenter, and I just wondering that I did something wrong.
I use box2d flash 2.1a in my project. And I currently subtract this position with half-width and half-height to walk around. Also, can you tell me if there is some way to solve my problem or draw the image in the correct positon in Box2D.
Thank you.
update
so sorry to post before read manual.
after RTM I got that body has two points,first is origin point and the second is center of mass ,so a regular shape's world center is always the same as it's origin point. sorry to post is.
Have you set the image in the userdata for the body? Your getting the body's position but you need to have a function that runs each world tick that can set the images position to the new location. Box2d is just numbers defining a simulation. Those numbers are constantly updating so the image needs to have position set each time there is a game tick. Hope this helps

Resources