Search Results

Search found 951 results on 39 pages for 'surface'.

Page 5/39 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Is a point inside or outside a polygon which is on the surface of a globe

    - by richard
    How do I determine if a point is inside or outside a polygon that lies on the the surface of the earth? The inside of the polygon can be determined via the right hand rule, ie. the inside of the polygon is on your right hand side when you walk around the polygon. The polygon may Circle either pole Cross the 180 longitude Cover more than 50% of the globe As the globe is a sphere the normal ray crossing algorithms do not work correctly.

    Read the article

  • Get coordinates of beads covering the surface of a protein

    - by Hefeweizen
    Given a protein structure from the PDB, I would like to generate NS spheres of radius Rs which cover totally the protein surface. Given RS there, NS is the maximum number of spheres so they do not overlap. I would need the coordinates of the center of each sphere. Does anybody know if this has been implemented in some method / program? Or how to do it with scripting. Thanks

    Read the article

  • c# - clear surface when resizing

    - by dhh
    Hello, I'm trying to build my own custom control for a windows forms application in C#.Net. Currently I paint some rectangles and other graphic elements using the paint event. When I now resize the app form to fit the desktop size, all elements are repainted (which is exactly the behaviour I need) but the old one's are shown in the background. Here's what I'm doing by now: Pen penDefaultBorder = new Pen(Color.Wheat, 1); int margin = 5; private void CustomControl_Paint(object sender, PaintEventArgs e) { CustomControl calendar = (CustomControl)sender; Graphics graphics = e.Graphics; graphics.Clear(Color.WhiteSmoke); graphics.DrawRectangle(penDefaultBorder, margin, margin, calendar.Width - margin * 2, calendar.Height - margin * 2); //... } Neither the graphics.Clear, nor adding a graphics.FillRectangle(...) will hide the old rectangle from the surface. Ideas? Thank you all.

    Read the article

  • Matplotlib plotting non uniform data in 3D surface

    - by Raj Tendulkar
    I have a simple code to plot the points in 3D for Matplotlib as below - from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt import numpy as np from numpy import genfromtxt import csv fig = plt.figure() ax = fig.add_subplot(111, projection='3d') my_data = genfromtxt('points1.csv', delimiter=',') points1X = my_data[:,0] points1Y = my_data[:,1] points1Z = my_data[:,2] ## I remove the header of the CSV File. points1X = np.delete(points1X, 0) points1Y = np.delete(points1Y, 0) points1Z = np.delete(points1Z, 0) # Convert the array to 1D array points1X = np.reshape(points1X,points1X.size) points1Y = np.reshape(points1Y,points1Y.size) points1Z = np.reshape(points1Z,points1Z.size) my_data = genfromtxt('points2.csv', delimiter=',') points2X = my_data[:,0] points2Y = my_data[:,1] points2Z = my_data[:,2] ## I remove the header of the CSV File. points2X = np.delete(points2X, 0) points2Y = np.delete(points2Y, 0) points2Z = np.delete(points2Z, 0) # Convert the array to 1D array points2X = np.reshape(points2X,points2X.size) points2Y = np.reshape(points2Y,points2Y.size) points2Z = np.reshape(points2Z,points2Z.size) ax.plot(points1X, points1Y, points1Z, 'd', markersize=8, markerfacecolor='red', label='points1') ax.plot(points2X, points2Y, points2Z, 'd', markersize=8, markerfacecolor='blue', label='points2') plt.show() My problem is that I tried to make a decent surface plot out of these data points that I have. I already tried to use ax.plot_surface() function to make it look nice. For this I eliminated some points, and recalculated the matrix kind of input needed by this function. However, the graph I generated was far more difficult to interpret and understand. So there might be 2 possibilities: either I am not using the function correctly, or otherwise, the data I am trying to plot is not good for the surface plot. What I was expecting was 3D graph which would have an effect similar to that we have of 3D pie chart. We see that one piece (that which is extracted out) is part of another piece. I was not expecting it to be exactly same like that, but some kind of effect like that. What I would like to ask is: Do you think it will be possible to make such 3D graph? Is there any way better, I could express my data in 3 dimension? Here are the 2 files - points1.csv Dim1,Dim2,Dim3 3,8,1 3,8,2 3,8,3 3,8,4 3,8,5 3,9,1 3,9,2 3,9,3 3,9,4 3,9,5 3,10,1 3,10,2 3,10,3 3,10,4 3,10,5 3,11,1 3,11,2 3,11,3 3,11,4 3,11,5 3,12,1 3,12,2 3,13,1 3,13,2 3,14,1 3,14,2 3,15,1 3,15,2 3,16,1 3,16,2 3,17,1 3,17,2 3,18,1 3,18,2 4,8,1 4,8,2 4,8,3 4,8,4 4,8,5 4,9,1 4,9,2 4,9,3 4,9,4 4,9,5 4,10,1 4,10,2 4,10,3 4,10,4 4,10,5 4,11,1 4,11,2 4,11,3 4,11,4 4,11,5 4,12,1 4,13,1 4,14,1 4,15,1 4,16,1 4,17,1 4,18,1 5,8,1 5,8,2 5,8,3 5,8,4 5,8,5 5,9,1 5,9,2 5,9,3 5,9,4 5,9,5 5,10,1 5,10,2 5,10,3 5,10,4 5,10,5 5,11,1 5,11,2 5,11,3 5,11,4 5,11,5 5,12,1 5,13,1 5,14,1 5,15,1 5,16,1 5,17,1 5,18,1 6,8,1 6,8,2 6,8,3 6,8,4 6,8,5 6,9,1 6,9,2 6,9,3 6,9,4 6,9,5 6,10,1 6,11,1 6,12,1 6,13,1 6,14,1 6,15,1 6,16,1 6,17,1 6,18,1 7,8,1 7,8,2 7,8,3 7,8,4 7,8,5 7,9,1 7,9,2 7,9,3 7,9,4 7,9,5 and points2.csv Dim1,Dim2,Dim3 3,12,3 3,12,4 3,12,5 3,13,3 3,13,4 3,13,5 3,14,3 3,14,4 3,14,5 3,15,3 3,15,4 3,15,5 3,16,3 3,16,4 3,16,5 3,17,3 3,17,4 3,17,5 3,18,3 3,18,4 3,18,5 4,12,2 4,12,3 4,12,4 4,12,5 4,13,2 4,13,3 4,13,4 4,13,5 4,14,2 4,14,3 4,14,4 4,14,5 4,15,2 4,15,3 4,15,4 4,15,5 4,16,2 4,16,3 4,16,4 4,16,5 4,17,2 4,17,3 4,17,4 4,17,5 4,18,2 4,18,3 4,18,4 4,18,5 5,12,2 5,12,3 5,12,4 5,12,5 5,13,2 5,13,3 5,13,4 5,13,5 5,14,2 5,14,3 5,14,4 5,14,5 5,15,2 5,15,3 5,15,4 5,15,5 5,16,2 5,16,3 5,16,4 5,16,5 5,17,2 5,17,3 5,17,4 5,17,5 5,18,2 5,18,3 5,18,4 5,18,5 6,10,2 6,10,3 6,10,4 6,10,5 6,11,2 6,11,3 6,11,4 6,11,5 6,12,2 6,12,3 6,12,4 6,12,5 6,13,2 6,13,3 6,13,4 6,13,5 6,14,2 6,14,3 6,14,4 6,14,5 6,15,2 6,15,3 6,15,4 6,15,5 6,16,2 6,16,3 6,16,4 6,16,5 6,17,2 6,17,3 6,17,4 6,17,5 6,18,2 6,18,3 6,18,4 6,18,5 7,10,1 7,10,2 7,10,3 7,10,4 7,10,5 7,11,1 7,11,2 7,11,3 7,11,4 7,11,5 7,12,1 7,12,2 7,12,3 7,12,4 7,12,5 7,13,1 7,13,2 7,13,3 7,13,4 7,13,5 7,14,1 7,14,2 7,14,3 7,14,4 7,14,5 7,15,1 7,15,2 7,15,3 7,15,4 7,15,5 7,16,1 7,16,2 7,16,3 7,16,4 7,16,5 7,17,1 7,17,2 7,17,3 7,17,4 7,17,5 7,18,1 7,18,2 7,18,3 7,18,4 7,18,5

    Read the article

  • Bouncing a ball off a surface

    - by Sagekilla
    Hi all, I'm currently in the middle of writing a game like Breakout, and I was wondering how I could properly bounce a ball off a surface. I went with the naive way of rotating the velocity by 180 degrees, which was: [vx, vy] -> [-vy, vx] Which (unsurprisingly) didn't work so well. If I know the position and veocity of the ball, as well as the point the ball would hit (but is going to instead bounce off of) how can I bounce it off that point? I don't need any language specific code. If anyone could provide a small, mathematical formula on how to properly do this that would work fine for me. I also need this to work with integer positions and velocity (I can't use floating point anywhere). Thanks!

    Read the article

  • Surface Area of a Spheroid in Python

    - by user3678321
    I'm trying to write a function that calculates the surface area of a prolate or oblate spheroid. Here's a link to where I got the formulas (http://en.wikipedia.org/wiki/Prolate_spheroid & http://en.wikipedia.org/wiki/Oblate_spheroid). I think I've written them wrong, but here is my code so far; from math import pi, sqrt, asin, degrees, tanh def checkio(height, width): height = float(height) width = float(width) lst = [] if height == width: r = 0.5 * width surface_area = 4 * pi * r**2 surface_area = round(surface_area, 2) lst.append(surface_area) elif height > width: #If spheroid is prolate a = 0.5 * width b = 0.5 * height e = 1 - a / b surface_area = 2 * pi * a**2 * (1 + b / a * e * degrees(asin**-1(e))) surface_area = round(surface_area, 2) lst.append(surface_area) elif height < width: #If spheroid is oblate a = 0.5 * height b = 0.5 * width e = 1 - b / a surface_area = 2 * pi * a**2 * (1 + 1 - e**2 / e * tanh**-1(e)) surface_area = round(surface_area, 2) lst.append(surface_area, 2) return lst

    Read the article

  • MatLab plot part of surface

    - by Kristian
    Say I have the following script: u = -5:.2:5; [X,Y] = meshgrid(u, u); Z = cos(X).*cos(Y).*exp(-sqrt(X.^2 + Y.^2)/4); surf(X,Y,Z); Is there anyway that I can make MatLab plot only parts of the surface? Say, for instance, I just want to plot a single point, or a single grid, what can I do? I thought perhaps to plot a single point I could use: surf(X(1,1), Y(1,1), Z(1,1)) But then I get the error message: ??? Error using ==> surf at 78 Data dimensions must agree. I would really appreciate some input/help here. Thanks in advance :)

    Read the article

  • Le bogue des nombres à virgule flottante refait surface en Java, il plonge le compilateur et les programmes dans des boucles infinies

    Le bogue des nombres à virgule flottante refait surface en Java Et plonge le compilateur et les programmes dans des boucles infinies Mise à jour du 08/02/2011 Quelque temps après sa correction sur PHP, le bogue étrange des nombres à virgule flottante refait surface sur un langage tout aussi populaire : Java. Ce bogue provoquait sur PHP avant sa correction le crash du système par le passage d'un simple paramètre dans l'URL, pour peu que le script convertisse en nombres ou utilise ces variables dans des opérations arithmétiques (pour plus de détails, lire ci-devant) Sur Java, un bogue similaire plon...

    Read the article

  • Surface Pro sera commercialisée entre 899$ et 999$, la tablette x86 de Microsoft officiellement disponible en janvier 2013

    Microsoft dévoile Surface deux modèles de tablettes Windows 8 ARM et Intel Microsoft a ouvert le bal des dispositifs sous Windows 8, et annoncé officiellement le lancement de deux tablettes sous le système d'exploitation. L'OS entièrement repensé, avec une nouvelle interface utilisateur, un support des architectures ARM et plusieurs autres nouveautés est l'occasion pour l'éditeur de se lancer pour la première fois dans la construction de ses propres dispositifs sous Windows. Baptisés Microsoft Surface, les deux modèles de tablettes sur deux puces différentes (ARM et X86) se positionnent comme de sérieux concurrents à l'iPad d'Apple qui domine largement le marché actuellement.

    Read the article

  • Surface s'affichera entre 300Euro et 800Euro selon les versions de la tablette sous Windows 8, d'après une indication du PDG de Microsoft

    Microsoft dévoile Surface deux modèles de tablettes Windows 8 ARM et Intel Microsoft a ouvert le bal des dispositifs sous Windows 8, et annoncé officiellement le lancement de deux tablettes sous le système d'exploitation. L'OS entièrement repensé, avec une nouvelle interface utilisateur, un support des architectures ARM et plusieurs autres nouveautés est l'occasion pour l'éditeur de se lancer pour la première fois dans la construction de ses propres dispositifs sous Windows. Baptisés Microsoft Surface, les deux modèles de tablettes sur deux puces différentes (ARM et X86) se positionnent comme de sérieux concurrents à l'iPad d'Apple qui domine largement le marché actuellement.

    Read the article

  • A Surface view and a canvas to move Bitmap

    - by John Apple Sim
    I have a SurfaceView and I want the Bitmap Logo inside it in the canvas to be movable What I'm doing wrong ? static float x, y; Bitmap logo; SurfaceView ss = (SurfaceView) findViewById(R.id.svSS); logo = BitmapFactory.decodeResource(getResources(), R.drawable.logo); x = 40; y = 415; ss.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent me) { try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } switch(me.getAction()) { case MotionEvent.ACTION_DOWN: x = me.getX(); y = me.getY(); break; case MotionEvent.ACTION_UP: x = me.getX(); y = me.getY(); break; case MotionEvent.ACTION_MOVE: x = me.getX(); y = me.getY(); break; } return true; } }); public class OurView extends SurfaceView implements Runnable{ Thread t = null; SurfaceHolder holder; boolean isItOK = false; public OurView(Context context) { super(context); holder = getHolder(); } public void run (){ while (isItOK == true){ //canvas DRAWING if (!holder.getSurface().isValid()){ continue; } Canvas c = holder.lockCanvas(); c.drawARGB(255, 200, 100, 100); c.drawBitmap(logo, x,y,null); holder.unlockCanvasAndPost(c); } } public void pause(){ isItOK = false; while(true){ try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } break; } t = null; } public void resume(){ isItOK = true; t = new Thread(this); t.start(); } } Now the surface view is just black .. nothing happens also its not colored 200, 100, 100

    Read the article

  • Why is my metro screen getting extended to half of the second screen?

    - by maximusyoda
    When I extend my desktop to the second screen, it stays fine for a few minutes, but after a while, the first metro screen stretches all the way to half of the second screen. The search bar etc stops working. The desktop itself shares fine. But the metro screen is messed up as well as the resolution. The second screen is using the recommended resolution. All I want is to have an extended screen. The problem occurs in my office Windows 8 laptop as well. Not sure what to do with it. Device: Surface Pro 2 External Monitor: Dell 2208WFP 1680 x 1050 Pixel Resoultion 22''

    Read the article

  • Can the traditional remote desktop client be accessed in Windows RT?

    - by nhinkle
    As mentioned in another question, I've been unable to connect through the Remote Desktop metro app to some computers, in particular those requiring VPN access or load balancers. I'm considering purchasing a Microsoft Surface RT, but given that the app store hasn't matured significantly yet and some niche software will likely never be ported to the Modern UI, I must have acess to remote systems somehow. Until Citrix fixes the receiver app for Windows 8, I'm stuck using remote desktop. Which doesn't work. I've heard that Windows RT comes with some of the Microsoft desktop programs built in, like Microsoft Office and File Explorer. Is the "normal" Remote Desktop Connection program available in Windows RT, and if so, is it 100% compatible with previous versions?

    Read the article

  • Customise on screen keyboard

    - by axrwkr
    How would one go about customising the on screen keyboard on a Microsoft Surface Pro? I've noticed that it doesn't have an alt or Esc key and I can't think of any good reason why those keys, among others, should not be there. In particular I want to use keys such as [ and ]. Also there are no up and down arrow keys. I already have a type cover but sometimes I'd like to use those keys without having the type cover attached. Ideally I'd like a way to enable those missing keys and perhaps to remove the ones that I don't want, such as the emoticon key.

    Read the article

  • Why doesn't Unity's OnCollisionEnter give me surface normals, and what's the most reliable way to get them?

    - by michael.bartnett
    Unity's on collision event gives you a Collision object that gives you some information about the collision that happened (including a list of ContactPoints with hit normals). But what you don't get is surface normals for the collider that you hit. Here's a screenshot to illustrate. The red line is from ContactPoint.normal and the blue line is from RaycastHit.normal. Is this an instance of Unity hiding information to provide a simplified API? Or do standard 3D realtime collision detection techniques just not collect this information? And for the second part of the question, what's a surefire and relatively efficient way to get a surface normal for a collision? I know that raycasting gives you surface normals, but it seems I need to do several raycasts to accomplish this for all scenarios (maybe a contact point/normal combination misses the collider on the first cast, or maybe you need to do some average of all the contact points' normals to get the best result). My current method: Back up the Collision.contacts[0].point along its hit normal Raycast down the negated hit normal for float.MaxValue, on Collision.collider If that fails, repeat steps 1 and 2 with the non-negated normal If that fails, try steps 1 to 3 with Collision.contacts[1] Repeat 4 until successful or until all contact points exhausted. Give up, return Vector3.zero. This seems to catch everything, but all those raycasts make me queasy, and I'm not sure how to test that this works for enough cases. Is there a better way?

    Read the article

  • When mapping the surface of a sphere with tiles, how might you deal with polar distortion?

    - by clweeks
    It's easy to deal with the way locations interact on a clean Cartesian grid. It's just vanilla math. And you can kind of ignore the geometry of the sphere's surface for a bunch of it if you want to just truncate the poles or something. But I keep coming up with ideas for games where the polar space matters. Geo-coded ARGs and global roguelikes and stuff. I want square(ish?) locations -- reasonably representable by square tiles of the same size across the globe, anyway. This has to be a solved problem, right? What are the solutions? ETA: At the equator -- and assuming that your square locations are reasonably small, it's close enough to true that you can get away with having one square in the rows north and south of the most equatorial row. And you could probably get away with that by just hand-waving the difference up to like 45-degrees or so. But eventually, you need to have fewer squares in a pole-ward circumferential row. If I reduce the length of the row by one and offset the squares by 1/2 then they're just like hexes and it's relatively easy to do the coding to keep track of the connections. But as you get pole-ward, it gets more and more extreme. Projecting the surface of the world onto the surface of a cube is tempting. But I figured there must be more elegant solutions already in use. If I did the cube thing (not dissecting it further through geodesy) Are there any pros and cons related to placing the pole at the center of a face or at the vertex of three sides?

    Read the article

  • IPhone accelerometer works even in flat surface.

    - by Amaresh
    I have an imageView in the view. It moves even if the iphone is still for some time. Why is it so ? Also the image does not respond quickly to the movement of the iphone. Here is my code written for this: I have also set the updateInterval and delegate for the accelerometer. #define kVelocityMultiplier 1000; -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { if(currentPoint.x < 0) { currentPoint.x=0; ballXVelocity=0; } if(currentPoint.x > 480-sliderWidth) { currentPoint.x=480-sliderWidth; ballXVelocity=0; } static NSDate *lastDrawTime; if(currentPoint.x<=480-sliderWidth&&currentPoint.x>=0) { if(lastDrawTime!=nil) { NSTimeInterval secondsSinceLastDraw=-([lastDrawTime timeIntervalSinceNow]); ballXVelocity = ballXVelocity + -acceleration.y*secondsSinceLastDraw; CGFloat xAcceleration=secondsSinceLastDraw * ballXVelocity * kVelocityMultiplier; currentPoint = CGPointMake(currentPoint.x + xAcceleration, 266); } slider.frame=CGRectMake(currentPoint.x, currentPoint.y, sliderWidth, 10); } [lastDrawTime release]; lastDrawTime=[[NSDate alloc]init]; } Can anyone help me out please ?

    Read the article

  • Nesting maximum amount of shapes on a surface

    - by Fuu
    In industry, there is often a problem where you need to calculate the most efficient use of material, be it fabric, wood, metal etc. So the starting point is X amount of shapes of given dimensions, made out of polygons and/or curved lines, and target is another polygon of given dimensions. I assume many of the current CAM suites implement this, but having no experience using them or of their internals, what kind of computational algorithm is used to find the most efficient use of space? Can someone point me to a book or other reference that discusses this topic?

    Read the article

  • Animating and rotating an image in a Surface View

    - by jax
    I would like to animate movement on a SurfaceView . Ideally I would like to also be notified once the animation had finished. For example: I might have a car facing North. If I wanted to animate it so that it faces South for a duration of 500ms, how could I do that? I am using a SurfaceView so all animation must be handled manually, I don't think I can use XML or the android Animator classes. Also, I would like to know the best way to animate something continuously inside a SurfaceView (ie. a walk cycle)

    Read the article

  • Fitting maximum amount of shapes on a surface

    - by Fuu
    In industry, there is often a problem where you need to calculate the most efficient use of material, be it fabric, wood, metal etc. So the starting point is X amount of shapes of given dimensions, made out of polygons and/or curved lines, and target is another polygon of given dimensions. I assume many of the current CAM suites implement this, but having no experience using them or of their internals, what kind of computational algorithm is used to find the most efficient use of space? Can someone point me to a book or other reference that discusses this subject?

    Read the article

  • Using Visual Studio 2010 Express to create a surface I can draw to

    - by Joel
    I'm coming from a Java background and trying to port a simple version of Conway's Game of Life that I wrote to C# in order to learn the language. In Java, I drew my output by inheriting from JComponent and overriding paint(). My new canvas class then had an instance of the simulation's backend which it could read/manipulate. I was then able to get the WYSIWYG GUI editor (Matisse, from NetBeans) to allow me to visually place the canvas. In C#, I've gathered that I need to override OnPaint() to draw things, which (as far as I know) requires me to inherit from something (I chose Panel). I can't figure out how to get the Windows forms editor to let me place my custom class. I'm also uncertain about where in the generated code I need to place my class. How can I do this, and is putting all my drawing code into a subclass really how I should be going about this? The lack of easy answers on Google suggests I'm missing something important here. If anyone wants to suggest a method for doing this in WPF as well, I'm curious to hear it. Thanks

    Read the article

  • How do I render my own DirectX Stuff to a full screen WPF's DirectX surface?

    - by marc40000
    Basically Danny Varod seems to know as he posted it as an answer to this question: Display a Message Box over a Full Screen DirectX application I think, theoretically this might work, but I have no idea how to actually do it. Since I'm also not allowed to post a comment under his comment nor am I allwoed to ask on meta about how to contact another user, I ask this as a normal question here: How do I render my own DirectX Stuff to a full screen WPF's DirectX surface? For starters, I have no idea how to get the DirectX surface from a WPF window. If I had it, what do I have to take care of that the WPF rendering doesn't screw up my own rending or vice-versa?

    Read the article

  • Best way to determine surface normal for a group of pixels?

    - by Paul Renton
    One of my current endeavors is creating a 2D destructible terrain engine for iOS Cocos2D (See https://github.com/crebstar/PWNDestructibleTerrain ). It is in an infant stages no doubt, but I have made significant progress since starting a couple weeks ago. However, I have run into a bit of a performance road block with calculating surface normals. Note: For my destructible terrain engine, an alpha of 0 is considered to not be solid ground. The method posted below works just great given small rectangles, such as n < 30. Anything above 30 causes a dip in the frame rate. If you approach 100x100 then you might as well read a book while the sprite attempts to traverse the terrain. At the moment this is the best I can come up with for altering the angle on a sprite as it roams across terrain (to get the angle for a sprite's orientation just take dot product of 100 * normal * (1,0) vector). -(CGPoint)getAverageSurfaceNormalAt:(CGPoint)pt withRect:(CGRect)area { float avgX = 0; float avgY = 0; ccColor4B color = ccc4(0, 0, 0, 0); CGPoint normal; float len; for (int w = area.size.width; w >= -area.size.width; w--) { for (int h = area.size.height; h >= -area.size.height; h--) { CGPoint pixPt = ccp(w + pt.x, h + pt.y); if ([self pixelAt:pixPt colorCache:&color]) { if (color.a != 0) { avgX -= w; avgY -= h; } // end inner if } // end outer if } // end inner for } // end outer for len = sqrtf(avgX * avgX + avgY * avgY); if (len == 0) { normal = ccp(avgX, avgY); } else { normal = ccp(avgX/len, avgY/len); } // end if return normal; } // end get My problem is I have sprites that require larger rectangles in order for their movement to look realistic. I considered doing a cache of all surface normals, but this lead to issues of knowing when to recalculate the surface normals and these calculations also being quite expensive (also how large should the blocks be?). Another smaller issue is I don't know how to properly treat the case when length is = 0. So I am stuck... Any advice from the community would be greatly appreciated! Is my method the best possible one? Or should I rethink the algorithm? I am new to game development and always looking to learn new tips and tricks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >