I am using Autodesk.Viewing.Markupscore extension to draw a polygon in 3D view in top view (orthographic)
I want to see only those elements which are inside the polygon
For which I am using the cutplanes concept because bounding box logic is taking too long to process.
So Please suggest a way to apply cut planes along these lines.
Try programmatically cutplanes with an array of vector4s specifying the four sides say:
vectorArray.push(new THREE.Vector4 (0.9999999999999998, 0, 0, 0.06520926952362059)) //x,y,z,w
viewer.setCutPlanes(vectorArray)
See documentation here
Related
Cesium has the ability to make circles (such as by creating an Entity with ellipse defined, for one), and arcs (polylines). But I haven't been able to find the way to create partial, filled-in, circles.
We use Cesium to display bar charts and other report details overlaid on a map.
We now have a request to display pie charts over the map. To do this, we'd need to be able to create, say, 50%, 30%, 20%, or some other arbitrary percentage of a circle, filled in with a given color. Is there a way to do this in Cesium?
I could just create an arc and two connecting lines, to create a partial circle outline, but I can't find a way to create a partial circle with a fill color (similar to what EllipseGraphics itself allows for.)
As of version 1.62, CesiumJS includes modifications I made to allow drawing partial ellipsoids. You should be able to leverage this to get what you want. For example,
let viewer = new Cesium.Viewer('cesiumContainer');
viewer.entities.add({
name: 'Pie piece',
position: Cesium.Cartesian3.fromDegrees(-100.0, 40.0),
ellipsoid: {
radii: new Cesium.Cartesian3(300000.0, 300000.0, 300000.0),
innerRadii: new Cesium.Cartesian3(1, 1, 1),
minimumClock: Cesium.Math.toRadians(0),
maximumClock: Cesium.Math.toRadians(270),
minimumCone : Cesium.Math.toRadians(89.8),
maximumCone : Cesium.Math.toRadians(90.2),
material: Cesium.Color.RED,
}
});
I try to use 2 ellipses to detect a collision if they overlap. I have to rotate the ellipses but I can't figure out how this works. I'm working with the "com.badlogic.gdx.math.Ellipse" class but it seems to have no method for rotating. Any ideas? Thx in advance!!
Unfortunately, LibGDX doesn't have in-built rotating functions for ellipses.
Instead, I'd either be resorting to a circle in which rotation does not matter, or use polygons to check intersection.
Polygons are formed through an array of float values (vertices), where, every even element of the array is the horizontal component (x) and the odd, the vertical component (y).
Polygon polygon1 = new Polygon(vertexSet1);
Polygon polygon2 = new Polygon(vertexSet2);
Then, by using an Intersector, you can then check whether these polygons have intersected. The more vertices, the more accurate your shape will be. Just remember to have 6 or more elements in your vertex array, as the 6 floats will give 3 (x, y) points which is the minimum required for a polygon.
if (intersector.overlapConvexPolygons(polygon1, polygon2) {
//do your intersection code
}
The polygons themselves have commands to translate, scale and rotate, allowing for the rotations you mentioned above.
Is there a way to change the style of the white squares that are used as vertex handles by default when a polyline is set to editable:true?
I can see that changing the stroke of the polyline affects those handle squares, but I'd like to either change the shape of handle (e.g. to a circle), or substitute an image.
The only way I've managed to found is a direct manipulation of DOM elements corresponding to those markers. For instance, they may be selected using
$('div').filter(function() {
return $(this).css('width') == '11px';
})
Probably, more reliable approach is a DOM tree traverse starting from $('.gm-style') element.
I wish to use PostGIS to select all the points within a polygon, but this question is about defining the actual polygon.
I'm looking to define a polygon that is based on a great circle, specified by two points on the earths surface defined by latitude and longitude coordinates. The polygon that I'm after should be defined by a width left and right of the the center line (the center line being the line made by the great circle)
The resulting shape would be a long curved rectangular shape.
The purpose being to select all the points within x distance of the great circle line.
I think you are confused about the kind of data you are dealing with, if you use a equidistant projection you could use something as simple as this:
ST_DWithIn(ST_MakeLine(point1, point2),distanceInSRIDunits)
There is an old discussion in the postgis mail list that will be useful to you.
I am playing with animation in AS3 and flex4, and I've come into a problem. My application is a game board (like a chess board), where each field is a border container added to some position.
Also I am adding a child element (shape), to this container on mouse click. What I want to achieve is to be able to move shapes smoothly from one field to another. But it appears that the shape goes behind the neighbor field this way http://screencast.com/t/iZ3DCdobs.
I believe this happens because shape is a child of specific border container, and to make it visible over every other container, I would need to use layers somehow....
I would be happy if anybody could suggest a solution
Yes you're right on that. You should add the movable objects to a different layer.
As there are no typical layers in AS, you could try to drop the fields in one sprite and any other objects to a different an than place them on each other, so that when you will move a object it won't go behind other objects.
If you place both sprites in the same position you will still have accurate x,y positions between movable objects and fields.
You have two options:
First one is to have different layers for your DisplayObjects: as an example, the bottom layer would hold all the boards, and the upper layer would hold all the pieces.
Second option is to manipulate the index of the objects with swapChildren(), swapChildrenAt(), and setChildIndex(). So to bring a MovieClip to the topmost front, you would do MovieClip(parent).setChildIndex(this, 0);
If the situation is that always the shape object gets hidden behind the next ( right side ) grid container, the I suggest you create your grid in reverse.
Suppose you are creating a chess grid. that is a 8x8 grid. Normally you would create your grid using 2 for loops, looping from 0 to 8 with say the x and y points starting at 0,0 for the first grid and going on till the end. What I suggest you to do is to create from 8,8 to 0,0.
Display objects in flash are stacked on top of each other based on their child index.
For example: If you create two objects. Rectangle and Circle as follows
var rect:Rectangle = new Rectangle();
this.addChild(rect);
var circ:Circle = new Circle();
this.addChild(circ);
The circle will always be on top of the rectangle in this scenario because the circle was added after the rectangle to the display list.
So if you reverse the order of creation of your grid, the right grid cell will be added to the display list first and so the grid cells to the left will always be on top of the right ones. Hence, the problem that you are facing will not occur.