Search Results

Search found 702 results on 29 pages for 'geometry'.

Page 9/29 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Method of transforming 3D vectors with a matrix

    - by Drew Noakes
    I've been doing some reading on transforming Vector3 with matrices, and am tossing up digging deeper into the math and coding this myself versus using existing code. For whatever reason my school curriculum never included matrices, so I'm filling a gap in my knowledge. Thankfully I only need a few simple things, I think. Context is that I'm programming a robot for the RoboCup 3D league. I'm coding it in C# but it'll have to run on Mono. Ideally I wouldn't use any existing graphics libraries for this (WinForms/WPF/XNA) as all I really need is a neat subset of matrix transformations. Specifically, I need translation and x/y/z rotations, and a way of combining multiple transformations into a single matrix. This will then be applied to my own Vector3 type to produce the transformed Vector3. I've read different advice about this. For example, some model the transformation with a 4x3 matrix, others with a 4x4 matrix. Also, some examples show that you need a forth value for the vector's matrix of 1. What happens to this value when it's included in the output? [1 0 0 0] [x y z 1] * [0 1 0 0] = [a b c d] [0 0 1 0] [2 4 6 1] The parts I'm missing are: What sizes my matrices should be Compositing transformations by multiplying the transformation matrices together Transforming 3D vectors with the resulting matrix As I mostly just want to get this running, any psuedo-code would be great. Information about what matrix values perform what transformations is quite clearly defined on many pages, so need not be discussed here unless you're very keen :)

    Read the article

  • Grouping rectangles (getting the bounding boxes of rects)

    - by hyn
    What is a good, fast way to get the "final" bounding boxes of a set of random (up to about 40, not many) rectangles? By final I mean that all bounding boxes don't intersect with any other. Brute force way: in a double for loop, for each rect, test for intersection against every other rect. The intersecting rects become a new rect (replaced), indicating the bounding box. Start over and repeat until no intersection is detected. Because the rects are random every time, and the rect count is relatively small, collision detection using spatial hashing seems like overkill. Is there a way to do this more effectively?

    Read the article

  • Calculate cubic bezier T value where tangent is perpendicular to anchor line.

    - by drawnonward
    Project a cubic bezier p1,p2,p3,p4 onto the line p1,p4. When p2 or p3 does not project onto the line segment between p1 and p4, the curve will bulge out from the anchor points. Is there a way to calculate the T value where the tangent of the curve is perpendicular to the anchor line? This could also be stated as finding the T values where the projected curve is farthest from the center of the line segment p1,p4. When p2 and p3 project onto the line segment, then the solutions are 0 and 1 respectively. Is there an equation for solving the more interesting case? The T value seems to depend only on the distance of the mapped control points from the anchor line segment. I can determine the value by refining guesses, but I am hoping there is a better way.

    Read the article

  • Render only the segment/area of a circle that intersects the main circle

    - by Greenhouse Gases
    I absolutely love maths (or 'math' as most of you would say!) but I haven't done it to a level where I know the answer to this problem. I have a main circle which could have a centre point at any x and y on a display. Other circles will move around the display at will but at any given call to a render method I want to render not only those circles that intersect the main circle, but also only render the segment of that circle that is visible inside the main circle. An analogy would be a shadow cast on a real life object, and I only want to draw the part of that object that is 'illuminated'. I want to do this preferably in Java, but if you have a raw formula that would be appreciated. I wonder how one might draw the shape and fill it in Java, I'm sure there must be some variation on a polyline with arcs or something? Many thanks

    Read the article

  • How to improve performance

    - by Ram
    Hi, In one of mine applications I am dealing with graphics objects. I am using open source GPC library to clip/merge two shapes. To improve accuracy I am sampling (adding multiple points between two edges) existing shapes. But before displaying back the merged shape I need to remove all the points between two edges. But I am not able to find an efficient algorithm that will remove all points between two edges which has same slope with minimum CPU utilization. Currently all points are of type PointF Any pointer on this will be a great help.

    Read the article

  • Projection matrix + world plane ~> Homography from image plane to world plane

    - by B3ret
    I think I have my wires crossed on this, it should be quite easy. I have a projection matrix from world coordinates to image coordinates (4D homogeneous to 3D homgeneous), and therefore I also have the inverse projection matrix from image coordinates to world "rays". I want to project points of the image back onto a plane within the world (which is given of course as 4D homogeneous vector). The needed homography should be uniquely identified, yet I can not figure out how to compute it. Of course I could also intersect the back-projected rays with the world plane, but this seems not a good way, knowing that there MUST be a homography doing this for me. Thanks in advance, Ben

    Read the article

  • calculate intersection between two segments in a symmetric way

    - by Elazar Leibovich
    When using the usual formulas to calculate intersection between two 2D segments, ie here, if you round the result to an integer, you get non-symmetric results. That is, sometimes, due to rounding errors, I get that intersection(A,B)!=intersection(B,A). The best solution is to keep working with floats, and compare the results up to a certain precision. However, I must round the results to integers after calculating the intersection, I cannot keep working with floats. My best solution so far was to use some full order on the segments in the plane, and have intersection to always compare the smaller segment to the larger segment. Is there a better method? Am I missing something?

    Read the article

  • Calculating 2D angles for 3D objects in perspective

    - by Will
    Imagine a photo, with the face of a building marked out. Its given that the face of the building is a rectangle, with 90 degree corners. However, because its a photo, perspective will be involved and the parallel edges of the face will converge on the horizon. With such a rectangle, is it possible to calculate the angle in 2D of the edges of a face that is 90 degrees to it? In the image below, the blue is the face marked on the photo, and I'm wondering how to calculate the 2D vector of the red lines of the other face:

    Read the article

  • Real life usage of the projective plane theory

    - by Elazar Leibovich
    I'm learning about the theory of the projective plane. Very generally speaking, it is an extension of the plane, which includes additional points which are defined as the intersection points of two parallel lines. In the projective plane, every two lines have an interesection point. Whether they're parallel or not. Every point in the projective plane can be represented by three numbers (you actually need less than that, but nevemind now). Is there any real life application which uses the projective plane? I can think that, for instance, a software which needs to find the intersections of a line, can benefit from always having an intersection point which might lead to simpler code, but is it really used?

    Read the article

  • Rectangles Covering

    - by den bardadym
    I have N rectangles with sides parallel Ox and Oy. Exists another rectangele (model). I need create algorithm, which can tell: is model covered by N rectangles? and code him. I have some ideas. First I think need sort rectangles by left side (it can be done by O(n log n)). Then I think need use vertical sweeping line. Thanks.

    Read the article

  • Great Circle & Rhumb line intersection

    - by Karl T
    I have a Latitude, Longitude, and a direction of travel in degrees true north. I would like to calculate if I will intersect a line defined by two more Lat/Lon points. I figure the two points defining the line would create my great circle and my location and azimuth would define my Rhumb line. I am only interested in intersections that will occur with a few hundred kilometers so I do not need every possible solution. I have no idea where to begin.

    Read the article

  • Perturb vector by some angle

    - by Myx
    Hello: I have a unit vector in 3D space whose direction I wish to perturb by some angle within the range 0 to theta, with the position of the vector remaining the same. What is a way I can accomplish this? Thanks.

    Read the article

  • Converting convex hull to binary mask

    - by Jonas
    I want to generate a binary mask that has ones for all pixels inside and zeros for all pixels outside a volume. The volume is defined by the convex hull around a set of 3D coordinates (<100; some of the coordinates are inside the volume). I can get the convex hull using CONVHULLN, but how do I convert that into a binary mask? In case there is no good way to go via the convex hull, do you have any other idea how I could create the binary mask?

    Read the article

  • Sort latitude and longitude coordinates into clockwise quadrangle

    - by Dave Jarvis
    Problem Users can provide up to four latitude and longitude coordinates, in any order. They do so with Google Maps. Using Google's Polygon API (v3), the coordinates they select should highlight the selected area between the four coordinates. Solutions and Searches http://stackoverflow.com/questions/242404/sort-four-points-in-clockwise-order Graham's scan seems too complicated for four coordinates Sort the coordinates into two arrays (one by latitude, the other longitude) ... then? Question How do you sort the coordinates in (counter-)clockwise order, using JavaScript? Code Here is what I have so far: // Ensures the markers are sorted: NW, NE, SE, SW function sortMarkers() { var ns = markers.slice( 0 ); var ew = markers.slice( 0 ); ew.sort( function( a, b ) { if( a.lat() < b.lat() ) { return -1; } else if( a.lat() > b.lat() ) { return 1; } return 0; }); ns.sort( function( a, b ) { if( a.lng() < b.lng() ) { return -1; } else if( a.lng() > b.lng() ) { return 1; } return 0; }); } What is a better approach? Thank you.

    Read the article

  • Generate 2D cross-section polygon from 3D mesh

    - by nornagon
    I'm writing a game which uses 3D models to draw a scene (top-down orthographic projection), but a 2D physics engine to calculate response to collisions, etc. I have a few 3D assets for which I'd like to be able to automatically generate a hitbox by 'slicing' the 3D mesh with the X-Y plane and creating a polygon from the resultant edges. Google is failing me on this one (and not much helpful material on SO either). Suggestions?

    Read the article

  • GIS: line_locate_point() in Python

    - by miracle2k
    I'm pretty much a beginner when it comes to GIS, but I think I understand the basics - it doesn't seem to hard. But: All these acronyms and different libraries, GEOS, GDAL, PROJ, PCL, Shaply, OpenGEO, OGR, OGC, OWS and what not, each seemingly depending on any number of others, is slightly overwhelming me. Here's what I would like to do: Given a number of points and a linestring, I want to determine the location on the line closest to a certain point. In other words, what PostGIS's line_locate_point() does: http://postgis.refractions.net/documentation/manual-1.3/ch06.html#line%5Flocate%5Fpoint Except I want do use plain Python. Which library or libraries should I have a look at generally for doing these kinds of spatial calculations in Python, and is there one that specifically supports a line_locate_point() equivalent?

    Read the article

  • Determining line orientation using vertex shaders

    - by Brett
    Hi, I want to be able to calculate the direction of a line to eye coordinates and store this value for every pixel on the line using a vertex and fragment shader. My idea was to calculate the direction gradient using atan2(Gy/Gx) after a modelview tranformation for each pair of vertices then quantize this value as a color intensity to pass to a fragment shader. How can I get access to the positions of pairs of vertices to achieve this or is there another method I should use? Thanks

    Read the article

  • Find point which sum of distances to set of other points is minimal

    - by Pawel Markowski
    I have one set (X) of points (not very big let's say 1-20 points) and the second (Y), much larger set of points. I need to choose some point from Y which sum of distances to all points from X is minimal. I came up with an idea that I would treat X as a vertices of a polygon and find centroid of this polygon, and then I will choose a point from Y nearest to the centroid. But I'm not sure whether centroid minimizes sum of its distances to the vertices of polygon, so I'm not sure whether this is a good way? Is there any algorithm for solving this problem? Points are defined by geographical coordinates.

    Read the article

  • Distance from a point to a polygon

    - by clwen
    I am trying to determine the distance from a point to a polygon in 2D space. The point can be inside or outside the polygon; The polygon can be convex or concave. If the point is within the polygon or outside the polygon with a distance smaller than a user-defined constant d, the procedure should return True; False otherwise. I have found a similar question: Distance from a point to a polyhedron or to a polygon. However, the space is 2D in my case and the polygon can be concave, so it's somehow different from that one. I suppose there should be a method simpler than offsetting the polygon by d and determining it's inside or outside the polygon. Any algorithm, code, or hints for me to google around would be appreciated.

    Read the article

  • A simple algorithm for polygon intersection

    - by Elazar Leibovich
    I'm looking for a very simple algorithm for computing the polygon intersection/clipping. That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons. I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation of the polygons' intersection (that is, a polygon with less points, but which is still contained in the polygons' intersection). But it is really important for me that the algorithm will be simple (cheaper testing) and preferably short (less code). edit: please note, I wish to obtain a polygon which represent the intersection. I don't need only a boolean answer to the question of whether the two polygons intersect.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >