Search Results

Search found 1510 results on 61 pages for 'barycentric coordinates'.

Page 23/61 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Python: Repeat elements in a list comprehension?

    - by User
    I have the following list comprehension which returns a list of coordinate objects for each location. coordinate_list = [Coordinates(location.latitude, location.longitude) for location in locations] This works. Now suppose the location object has a number_of_times member. I want a list comprehension to generate n Coordinate objects where n is the number_of_times for the particular location. So if a location has number_of_times = 5 then the coordinates for that location will be repeated 5 times in the list. (Maybe this is a case for a for-loop but I'm curious if it can be done via list comprehensions)

    Read the article

  • Using polyfit to predict where the object falls ?

    - by ZaZu
    Hi there, I have information of an object being thrown at a parabolic pattern. There are 30 images in total taken at specific intervals from the start position till the end. Now I have managed to extract the x,y coordinates of the object being thrown in all 30 images... I think that using polyfit (or maybe polyval ? ) may help me predict where the object will fall after the first 15 images ... I just want to know, how can polyfit be used with the 30 x,y coordinates I have ? ( I have a loop to extract each image from a mat file 1 row at a time until 30 .. and then plot that image .. so should I use polyfit in the same loop before/after the plot ??? Any ideas ?? Thanks !

    Read the article

  • How can I find the nearest intersection via the Google Maps API?

    - by dusoft
    How can I find the closest intersection of the street I have coordinates of? For instance, say I have street A running from south to north that is crossed by street X on the north and by street Y on the south. Does the Google Maps API allow for finding coordinates of the nearest crossroad (either X or Y) of street A? I couldn't find it mentioned anywhere. PS: The only solution I am aware of is to guess the lowest number and the highest number of building on the street A and to draw polyline between them. I am not sure about this though.

    Read the article

  • gMaps suddenly stopped working : Can't find variable: G_NORMAL_MAP

    - by Luca
    hello! i inject a map on my div called "concessionario-map" with GMap, a jquery plugin. Gmap everything works fine until this morning. now the debugger says: ReferenceError: Can't find variable: G_NORMAL_MAP i just search on google and i read some similar situation, but i dont find a case like mine. please, can you help me? thanks a lot in advance :) (full code) $.getJSON("http://maps.google.com/maps/geo?q="+loc+"&key=ABQIAAAAgDXoBEgIn38xaRBBqo6ygxTDjF32IQ1zA0BVcGSuGouGRvo0kRRKiyipbCniJWSso2scatdz36K-Mg&sensor=false&output=json&callback=?",function(data, textStatus) { long = data.Placemark[0].Point.coordinates[0]; lat = data.Placemark[0].Point.coordinates[1]; console.log(data); $('#concessionario-map').gMap( { scrollwheel: false, latitude: lat, longitude: long, zoom: 15, markers: [{ latitude: lat, longitude: long }], icon: { image: "files/images/gmap_pin_orange.png", shadow: "files/images/gmap_pin_orange_shadow.png", iconsize: [26, 46], shadowsize: [28, 48], iconanchor: [12,46], infowindowanchor: [12, 0] } }) });

    Read the article

  • direct access to vector elements similar to arrays

    - by mixm
    hi. im currently creating a tile based game, where elements of the games are placed in four different vectors (since there are multiple game objects with different properties, hence stored in different vectors). these game elements themselves contain x and y coordinates similar to how they are stored in a two dimensional array. i was wondering if there was a way to access these vector elements similar to two dimensional array access (currently i am implementing an for loop to cycle the elements while comparing its coordinates). this kinda sucks when i need to refresh my display at every game cycle (since the large number of comparisons and loops). im implementing this in java btw.

    Read the article

  • I'm an idiot/blind and I can't find why I'm getting a list index error. Care to take a look at these 20 or so lines?

    - by Meff
    Basically it's supposed to take a set of coordinates and return a list of coordinates of it's neighbors. However, when it hits here:if result[i][0] < 0 or result[i][0] >= board.dimensions: result.pop(i) when i is 2, it gives me an out of index error. I can manage to have it print result[2][0] but at the if statement it throws the errors. I have no clue how this is happening and if anyone could shed any light on this problem I'd be forever in debt. def neighborGen(row,col,board): """ returns lists of coords of neighbors, in order of up, down, left, right """ result = [] result.append([row-1 , col]) result.append([row+1 , col]) result.append([row , col-1]) result.append([row , col+1]) #prune off invalid neighbors (such as (0,-1), etc etc) for i in range(len(result)): if result[i][0] < 0 or result[i][0] >= board.dimensions: result.pop(i) if result[i][1] < 0 or result[i][1] >= board.dimensions: result.pop(i) return result

    Read the article

  • Searching a 2D array for a range of values in java

    - by Paige O
    I have a 2^n size int array and I want to check if an element exists that is greater than 0. If the element exists, I want to divide the array by 4 and check if the coordinates of the found element are in the 1st, 2nd, 3rd or 4th quadrant of the array. For example, logically if the element exists in the first quadrant it would look something like this: If array[][] 0 && the row of that coordinate is in the range 0-(grid.length/2-1) && the column of that coordinate is in the range 0-(grid.length/2-1) then do something. I'm really not sure how to check the row and column index of the found element and store those coordinates to use in my if statement. Help!

    Read the article

  • Matlab: How to find the right-most point of a white line within the imrect?

    - by mchlfchr
    i've got a question regarding the imrect() function, which is part of the image processing toolbox in MatLab. I'd like to find a starting point within an image. I use the imrect function for setting a region to limit and specify the lookup area, but I can't get the point where the ROI mask is getting back mapped to the original size of the image. As you can see on the image there is a specified rectangle (cyan-colored), which I want to inspect for the white line, especially the nearest point to the right edge of the rectangle. I experimentated with only looking up on the last column of the rectangle, but as I mentioned before, the re-mapping onto the global image coordinates failed. So in this example, the white point I'd like to get would be around (98,302) The original (x,y) coordinates are relevant, so a cropping of the image to the rectangle is not acceptable. So, do you have any ideas? Thanks for any helping comments. Kind regards,

    Read the article

  • Expected specifier-qualifier-list before 'CGPoint'

    - by Rob
    My project compiles and runs fine unless I try to compile my Unit Test Bundle it bombs out on the following with an "Expected specifier-qualifier-list before 'CGPoint'" error on line 5: #import <Foundation/Foundation.h> #import "Force.h" @interface WorldObject : NSObject { CGPoint coordinates; float altitude; NSMutableDictionary *forces; } @property (nonatomic) CGPoint coordinates; @property (nonatomic) float altitude; @property (nonatomic,retain) NSMutableDictionary *forces; - (void)setObject:(id)anObject inForcesForKey:(id)aKey; - (void)removeObjectFromForcesForKey:(id)aKey; - (id)objectFromForcesForKey:(id)aKey; - (void)applyForces; @end I have made sure that my Unit Test Bundle is a target of my WorldObject.m and it's header is imported in my testing header: #define USE_APPLICATION_UNIT_TEST 1 #import <SenTestingKit/SenTestingKit.h> #import <UIKit/UIKit.h> #import "Force.h" #import "WorldObject.h" @interface LogicTests : SenTestCase { Force *myForce; WorldObject *myWorldObject; } @end

    Read the article

  • How do you detect when the mouse leaves the stage in ActionScript 2?

    - by Theo
    I have the bad luck of having to downport some ActionScript 3 code to ActionScript 2 and I have a problem with detecting when the mouse leaves the stage. In ActionScript 3 there is an event called Event.MOUSE_LEAVE, which can be used to detect when the mouse leaves the stage, but there is no equivalent in ActionScript 2 as far as I can see. How would you best emulate the same functionality? Listening for mouse movement and checking the mouse coordinates against the bounds of the stage doesn't work because the mouse coordinates stop updating when the mouse leaves the stage.

    Read the article

  • Generating a random displacement on the unit sphere

    - by becko
    Given a unit vector n, I need to generate, as fast as possible, another random unit vector m. The deviation of m from n should be on the order of a positive parameter sigma, and the distribution of m on the unit sphere should be symmetrical around n. I have no specific requirements on the representation of unit vectors, so you can use spherical angles, Cartesian coordinates, or whatever turns out to be convenient. Also, there are no precise requirements on the probability distributions used, as long as it decays when m deviates more than sigma from n. I am working with gsl and C. I have come up with a somewhat convoluted method using Cartesian coordinates. I will post it later if it is useful, but I would like to see people's ideas.

    Read the article

  • How to color a mesh with values at the vertices in WPF 3D?

    - by Christo
    We've got a sphere which we want to display in 3D and color given a fuction that depends on spherical coordinates. The sphere was triangulated using a regular grid in (theta, phi), but this produced a lot of small triangles near the poles. In an attempt to reduce the number triangles at the poles, we've changed out mesh generation to produce more evenly sized triangles over the surface. The first triangulation method had the advantage that we could easily create a texture and drape it over the surface. It seems that in WPF it isn't possible to assign colors to vertices the way one would go about in OpenGL or Direct3D. With the second triangulation method it isn't apparent how to go about generating the texture and setting the texture coordinates, since the vertices aren't aligned to a grid anymore. Maybe it would be possible to create a linear texture containing a color for each vertex, but then how will that effect the coloring? Will it still render smoothly over the triangle surfaces as one would expect by applying per vertex coloring?

    Read the article

  • Send data to webserver from C#, what's the most efficient way?

    - by Brian
    I am sending gps coordinates from a windows mobile phone to a webserver using a basic program I wrote in C#. The problem is the data plan on the phone only allows 4 MB per month. I was planning on updating the location every 10 seconds. Currently I am just creating a webrequest every 10 seconds to a php page on the server and the coordinates are passed over in the url, the php page saves them to the database. This generates about 1K of data per request, at this rate I will hit my data limit in less than a day. Is there a more efficient way to do this?

    Read the article

  • Fastest way to find the rotation of a vector

    - by kriss
    I have two 2D vectors, say u and v, defined by cartesian coordinates. Imagine that vectors are needles of a clock. I'm looking for the fastest way to find out, using python, if v is after or before u (or in other words find out in wich half plane is v, regarding to position of u). For the purpose of the problem if vectors are aligned answer should be before. It seems easy using some trigonometry, but I believe there should be a faster way using coordinates only. My test case: def after(u, v): """code here""" after((4,2), (6, 1)) : True after((4,2), (3, 3)) : False after((4,2), (2, 1)) : False after((4,2), (3, -3)) : True after((4,2), (-2, -5)) : True after((4,2), (-4, -2)) : False

    Read the article

  • The C vs. C++ way

    - by amc
    Hi, So I have to write a program that will iterate through an image and record the pixel locations corresponding to each color pixel that appears in it. For example, given http://www.socuteurl.com/fishywishykissy I need to find the coordinates of all yellow, purple, dark pink, etc pixels. In C++ I would use a hash table to do this. I would iterate through the image, check each pixel's value, look up that value and either add to a vector of pixel coordinates if it were found or add a new entry to the table if the value were not already there. The problem is that I may need to write this program in pure C instead of C++. How would I go about doing this in C? I feel like implementing a hash table would be pretty obnoxious and error-prone: should I avoid doing that? I'm pretty inexperienced with C and have a fair amount of C++ experience, if that matters. Thanks.

    Read the article

  • multiple regionDidChangeAnimated calls - what gives?

    - by mvexel
    I have a MKMapView inside a UITableView as a custom cell (don't ask ;) - don't know if it matters really), for which I register a regionDidChangeAnimated delegate method. This method gets called three times when the UITableView is loaded - once with the actual region and then two more times with a region that is way off. In the simulator, I consistently get a region with center (+37.43997405, -97.03125000). On the device, it seems to depend on the location reported by the location manager, which initializes the map view. Why am I getting three regionDidChangeAnimated calls? And why are the center coordinates for the last two of them off? This is the code I use to get the center coordinates: - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated { CLLocation *l = [[CLLocation alloc] initWithLatitude:self.mapView.centerCoordinate.latitude longitude:self.mapView.centerCoordinate.longitude]; (....)

    Read the article

  • Get the size of a Silverlight window

    - by Aidenn
    Hey! I'm creating a Silverlight 4 Out Of Browser application. I have my MainPage that will be the "central" application. I want to be able to display another Control next to the MainPage, by using a Popup and I want it to be displayed right next to the MainPage. How can I get the coordinates of the upper right corner of the MainPage at each moment? (Beware that this MainPage can be moved all over the screen and hence I will need to dynamically get the corner coordinates, in order to display my popup right next to the main window). Any thoughts on this? Thank you!! PS: the code is in C# :-)

    Read the article

  • Combining bordering shapefiles in R

    - by Stedy
    I have five shapefiles of bordering counties in California that I am trying to combine into one large shapefile and maintain the original borders of the counties. I then want to plot points such as this so the map only needs to be a simple map of county boundaries. Is there a way to do this in R or will I have to use something like ArcGIS? There is extensive documentation about merging within a shapefile such as here where both shapefiles have the same coordinates. But no documentation on shapefiles that only partially share coordinates.

    Read the article

  • Centre of a circle that intersects two points

    - by Jason
    Given two points in a 2D plane, and a circle of radius r that intersects both of those points, what would be the formula to calculate the centre of that circle? I realise there would two places the circle can be positioned. I would want the circle whose centre is encountered first in a clockwise direction when sweeping the line that joins the two points around one of those points, starting from an arbitrary angle. I guess that is the next stage in my problem, after I find an answer for the first part. I'm hoping the whole calculation can be done without trigonometry for speed. I'm starting with integer coordinates and will end with integer coordinates, if that helps.

    Read the article

  • MATLAB pdist function

    - by James
    Hi, I am using the pdist command to find the distance between x and y coordinates stored in a matrix. X = [100 100; 0 100; 100 0; 500 400; 300 600;]; D = pdist(X,'euclidean') Which returns a 15 element vector. : [0.734979755525412 3.40039811339820 2.93175207511321 1.83879677592575 2.40127440268306 2.75251513299386 2.21488402640753 1.10610649500317 1.81674017301699 0.903207751535635 1.99116952754924 1.05069952386082 1.24122819418333 1.08583377275532 1.38729428638035] Is there a way to associate these distances with the coordinates they were derived from, i.e. store them in a matrix with the general row form: [Length xcoordinate1 ycoordinate1 xcoordinate2 ycoordinate2] Where there is a row for each length found? Thanks in advance

    Read the article

  • Detecting touch area on Android

    - by HappyAppDeveloper
    Is it possible to detect every pixel being touched? More specifically, when the user touches the screen, is it possible to track all the x-y coordinates of the cluster of points touched by the user? How can I tell the difference between when users are drawing with their thumb and when they are drawing with the tip of a finger? I would like to reflect the brush difference depending on how users touch the screen, and would also like to track x-y coordinates of all the pixels being touched over time. Thanks so much in advance for any help.

    Read the article

  • Figuring out QuadCurveTo's parameters

    - by Fev
    Could you guys help me figuring out QuadCurveTo's 4 parameters , I tried to find information on http://docs.oracle.com/javafx/2/api/javafx/scene/shape/QuadCurveTo.html, but it's hard for me to understand without picture , I search on google about 'Quadratic Bezier' but it shows me more than 2 coordinates, I'm confused and blind now. I know those 4 parameters draw 2 lines to control the path , but how we know/count exactly which coordinates the object will throught by only knowing those 2 path-controller. Are there some formulas? import javafx.animation.PathTransition; import javafx.animation.PathTransition.OrientationType; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.scene.shape.QuadCurveTo; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; public class _6 extends Application { public Rectangle r; @Override public void start(final Stage stage) { r = new Rectangle(50, 80, 80, 90); r.setFill(javafx.scene.paint.Color.ORANGE); r.setStrokeWidth(5); r.setStroke(Color.ANTIQUEWHITE); Path path = new Path(); path.getElements().add(new MoveTo(100.0f, 400.0f)); path.getElements().add(new QuadCurveTo(150.0f, 60.0f, 100.0f, 20.0f)); PathTransition pt = new PathTransition(Duration.millis(1000), path); pt.setDuration(Duration.millis(10000)); pt.setNode(r); pt.setPath(path); pt.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT); pt.setCycleCount(4000); pt.setAutoReverse(true); pt.play(); stage.setScene(new Scene(new Group(r), 500, 700)); stage.show(); } public static void main(String[] args) { launch(args); } } You can find those coordinates on this new QuadCurveTo(150.0f, 60.0f, 100.0f, 20.0f) line, and below is the picture of Quadratic Bezier

    Read the article

  • OpenGL ES perspective projection

    - by TimeManx
    I'm having a hard time understanding how glFrustum & gluPerspective work. I understand the concept of perspective projection but the functions aren't behaving how I expect them to. For example, if I set the frustum this way glFrustumf(0, 10, 0, 10, 1, 100) and have a rectangle at points 0, 0, 1, 0, 10, 1, 10, 10, 1, 10, 0, 1 then the rectangle is drawn with its left edge at -5 & right edge at 5, so the left half of the rectangle isn't visible. And if x is translated, I'd expect y to be too. But that doesn't happen either. In whatever examples I've seen, the coordinates for the projection matrix are taken as glFrustumf(-10, 10, -10, 10, 1, 100) but either way, whatever part is shown should be dependent on the rectangle's coordinates, right?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >