Search Results

Search found 354 results on 15 pages for 'circles'.

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

  • fast java2d translucency

    - by mdriesen
    I'm trying to draw a bunch of translucent circles on a Swing JComponent. This isn't exactly fast, and I was wondering if there is a way to speed it up. My custom JComponent has the following paintComponent method: public void paintComponent(Graphics g) { Rectangle view = g.getClipBounds(); VolatileImage image = createVolatileImage(view.width, view.height); Graphics2D buffer = image.createGraphics(); // translate to camera location buffer.translate(-cx, -cy); // renderables contains all currently visible objects for(Renderable r : renderables) { r.paint(buffer); } g.drawImage(image.getSnapshot(), view.x, view.y, this); } The paint method of my circles is as follows: public void paint(Graphics2D graphics) { graphics.setPaint(paint); graphics.fillOval(x, y, radius, radius); } The paint is just an rgba color with a < 255: Color(int r, int g, int b, int a) It works fast enough for opaque objects, but is there a simple way to speed this up for translucent ones?

    Read the article

  • Drawing continuously in drawing application

    - by user146780
    I was wondering how drawing applications draw the entire time the mouse is down without having empty gaps. What I mean is, for example if the program only drew circles at the mouse's X, y coordinate, then if the mouse went too quicly it would seem like a bunch of little circles rather than a nice continuous line. How can this be done without constantly drawing a short straight line between where the mouse was 0.001 seconds ago and where the mouse now is. Thanks

    Read the article

  • Zooming in an NSView

    - by jasonbogd
    Hi, I have an NSView in which the user can draw circles. These circles are stored as an array of NSBezierPaths, and in drawRect:, I loop through the array and call -stroke on each of the paths. How do I add a button to zoom in and out the NSView? Just change the bounds of the view? Thanks.

    Read the article

  • How do display checked value in checkbox on Google plus style popup box?

    - by user946742
    After reading this post on Stackoverflow Google plus popup box when hovering over thumbnail? I was inspirted to add it on my site. I managed to do so and the script adds the contacts to my database. So far awesome! However, my problem (and also appears in the example) is it does not display the "checked" value... so the user will never know if they already added them to their list or not. Is the correct way to display checked values with PHP? Here is my html code: <ul style="list-style: none;padding:2px;"> <li style="padding:5px 2px;"> <input type="checkbox" id="Friends" name="circles" value="Friends" '.$checked1.'/> Friends </li> <li style="padding:5px 2px;"> <input type="checkbox" id="Following" name="circles" value="Following" '.$checked2.'/>Following </li> <li style="padding:5px 2px;"> <input type="checkbox" id="Family" name="circles" value="Family" '.$checked3.'/> Family </li> <li style="padding:5px 2px;"> <input type="checkbox" id="Acquaintances" name="circles" value="Acquaintances" '.$checked4.'/> Acquaintances </li> </ul> And my PHP code is: if($circle_check_friends>0) { $ckecked1='checked=""'; } else if ($circle_check_following>0) { $ckecked2='checked=""'; } else if ($circle_check_family>0) { $ckecked3='checked=""'; } else if ($circle_check_acquaintances>0) { $ckecked4='checked=""'; } else if ($circle_check_friends=0) { $ckecked1=''; } else if ($circle_check_following=0) { $ckecked2=''; } else if ($circle_check_family=0) { $ckecked3=''; } else if ($circle_check_acquaintances=0) { $ckecked4=''; } Im lost because this is not giving me the result I want... i.e. for the checked values to be displayed according to the users choice. Your help is highly appreciated Thank you all in advance George

    Read the article

  • DRUPAL: replace tags with icons

    - by Patrick
    hi, is there any plugin for Drupal, replacing tags with small icons (see the picture below, the icons are actually small circles, and the different colors are automatically generated. I need to replace the tags with the circles, for each node, and the starting view. Furthermore, when the mouse move over the tags, the tag title should appear as pop-up thanks

    Read the article

  • how to add a map into a gui axis button?

    - by tharani.t
    hi i m working on matlab GUI. in GUI axis button i placed some concentric circles. now i want to place one map on the same axis. then on that map i want to draw my concentric circles. my map shouldnt disturb my old events. plzzzzzzzzzzzzz find me one good solution.

    Read the article

  • how to keep display tick rate steady when using continuous collision detection?

    - by nas Ns
    (I've just found about this forum). I hope it is ok to repost my question again here. I posted this question at stackoverflow, but it looks like I might get better help here. Here is the question: I've implemented basic particles motion simulation with continuous collision detection. But there is small issue in display. Assume simple case of circles moving inside square. All elastic collisions. no firction. All motion is constant speed. No forces are involved, no gravity. So when a particle is moving, it is always moving at constant speed (in between collisions) What I do now is this: Let the simulation time step be 1 second (for example). This is the time step simulation is advanced before displaying the new state (unless there is a collision sooner than this). At start of each time step, time for the next collision between any particles or a particle with a wall is determined. Call this the TOC time; let’s say TOC was .5 seconds in this case. Since TOC is smaller than the standard time step, then the system is moved by TOC and the new system is displayed so that the new display shows any collisions as just taking place (say 2 circles just touched each other’s, or a circle just touched a wall) Next, the collision(s) are resolved (i.e. speeds updated, changed directions etc..). A new step is started. The same thing happens. Now assume there is no collision detected within the next 1 second (those 2 circles above will not be in collision any more, even though they are still touching, due to their speeds showing they are moving apart now), Hence, simulation time is advanced now by the full one second, the standard time step, and particles are moved on the screen using 1 second simulation time and new display is shown. You see what has just happened: One frame ran for .5 seconds, but the next frame runs for 1 second, may be the 3rd frame is displayed after 2 seconds, may be the 4th frame is displayed after 2.8 seconds (because TOC was .8 seconds then) and so on. What happens is that the motion of a particle on the screen appears to speed up or slow down, even though it is moving at constant speed and was not even involved in a collision. i.e. Looking at one particle on its own, I see it suddenly speeding up or slowing down, becuase another particle had hit a wall. This is because the display tick is not uniform. i.e. the frame rate update is changing, giving the false illusion that a particle is moving at non-constant speed while in fact it is moving at constant speed. The motion on the screen is not smooth, since the screen is not updating at constant rate. I am not able to figure how to fix this. If I want to show 2 particles at the moment of the collision, I must draw the screen at different times. Drawing the screen always at the same tick interval, results in seeing 2 particles before the collision, and then after the collision, and not just when they colliding, which looked bad when I tried it. So, how do real games handle this issue? How to display things in order to show collisions when it happen, yet keep the display tick constant? These 2 requirements seem to contradict each other’s.

    Read the article

  • Why is my simple python gtk+cairo program running so slowly/stutteringly?

    - by synapz
    My program draws circles moving on the window. I think I must be missing some basic gtk/cairo concept because it seems to be running too slowly/stutteringly for what I am doing. Any ideas? Thanks for any help! #!/usr/bin/python import gtk import gtk.gdk as gdk import math import random import gobject # The number of circles and the window size. num = 128 size = 512 # Initialize circle coordinates and velocities. x = [] y = [] xv = [] yv = [] for i in range(num): x.append(random.randint(0, size)) y.append(random.randint(0, size)) xv.append(random.randint(-4, 4)) yv.append(random.randint(-4, 4)) # Draw the circles and update their positions. def expose(*args): cr = darea.window.cairo_create() cr.set_line_width(4) for i in range(num): cr.set_source_rgb(1, 0, 0) cr.arc(x[i], y[i], 8, 0, 2 * math.pi) cr.stroke_preserve() cr.set_source_rgb(1, 1, 1) cr.fill() x[i] += xv[i] y[i] += yv[i] if x[i] > size or x[i] < 0: xv[i] = -xv[i] if y[i] > size or y[i] < 0: yv[i] = -yv[i] # Self-evident? def timeout(): darea.queue_draw() return True # Initialize the window. window = gtk.Window() window.resize(size, size) window.connect("destroy", gtk.main_quit) darea = gtk.DrawingArea() darea.connect("expose-event", expose) window.add(darea) window.show_all() # Self-evident? gobject.idle_add(timeout) gtk.main()

    Read the article

  • Most "thorough" distribution of points around a circle

    - by hippietrail
    This question is intended to both abstract and focus one approach to my problem expressed at "Find the most colourful image in a collection of images". Imagine we have a set of circles, each has a number of points around its circumference. We want to find a metric that gives a higher rating to a circle with points distributed evenly around the circle. Circles with some points scattered through the full 360° are better but circles with far greater numbers of points in one area compared to a smaller number in another area are less good. The number of points is not limited. Two or more points may coincide. Coincidental points are still relevant. A circle with one point at 0° and one point at 180° is better than a circle with 100 points at 0° and 1000 points at 180°. A circle with one point every degree around the circle is very good. A circle with a point every half degree around the circle is better. In my other (colour based question) it was suggested that standard deviation would be useful but with caveat. Is this a good suggestion and does it cope with the closeness of 359° to 1°?

    Read the article

  • Touch draw in Quatz 2D/Core Graphics

    - by OgreSwamp
    Hello, I'm trying to implement "hand draw tool". At the moment algorythm looks like that (I don't insert any code because methods are quite big, will try to explain an idea): Drawing In touchesStarted: method I create NSMutableArray *pointsArray and add point into it. Call setNeedsDisplay: method. In touchesMoved: method I calculate points between last added point from the pointsArray and current point. Add all points to the pointsArray. Call setNeedsDisplay: method. In touchesFinished: event I calculate points between last added point from the array and current point. Set flag touchesWereFinished. Call setNeedsDisplay:. Render: drawRect: method checks is pointsArray != nil and is there any data in it. If there is - it starts to traw circles in each point of this array. If flag touchesWereFinished is set - save current context to the UIImage, release pointsArray, set it to nil and reset the flag. There are a lot disadvantages of this method: It is slow It becomes extremely slow when user touches and move finger for long time. Array becomes enormous "Lines" composed by circles are ugly I would like to change my algorithm to make it bit faster and line smoother. In result I would like to have lines like on the picture at following URL (sorry, not enough reputation to insert an image): http://2.bp.blogspot.com/_r5VzEAUYXJ4/SrOYp8tJCPI/AAAAAAAAAMw/ZwDKXiHlhV0/s320/SketchBook+Mobile(4).png Can you advice me, ho I can draw lines this way (smooth and slim on the edges)? I thought to draw circles with alpha gradient on the edges (to make lines smoother), but it will be extremely slowly IMHO. Thanks for help

    Read the article

  • How do I implement a group of strings that starts randomly, but is bound by relevance upon selection?

    - by Freakishly
    Okay the title may be a little confusing, but here's what I'm trying to do :) I have a game in XNA where every tap from the user draws a moving circle on the screen. The circle has a tag, say 'dogs' displayed on it. So imagine multiple taps on the screen, and we have all these circles of various colors and sizes moving around the screen with different (but constant) velocities. Each circle with different tags: 'dogs', 'cats' and so on... Clicking on empty space generates a new circle at that point. Clicking on one of the circles "selects" it, turning it into a greeen shade and slowing its velocity down to a fraction of what it was. Clicking on it again "unselects" it, and restores its original color and velocity (trajectory does not change). With each circle comes a tag, and as of now I'm populating these tags randomly from a string array (which means there's a chance tags will repeat). I would like the tags for newly created circles to be relevant to previous "selected" tags. So when I click on 'dogs', I would like 'German Shepherd' but I would also like 'dog parks' and 'lemurs' assuming dogs get along well with lemurs. What would be the best way to approach this problem. In my head I have a massive many-to-many mapping, but I can't seem to translate it to code. Thanks for looking. FYI I'm using the sample project from here: http://mobile.tutsplus.com/tutorials/windows/introduction-to-xna-on-windows-phone-7/

    Read the article

  • Word 2007 Smart Arts - how deep can I go?

    - by Franz
    In Office Word 2007, I want to use a Smart Art to create a hierarchical diagram for an organization. I want to use the one called "simple radial" (at least that's my word-to-word translation from German - it's the one with the circle in the middle and other circles around it, attached by lines). However, it seems to only support one level of depth (at least for circles). Everything else just becomes a bulleted list inside of the circle. Is there any way to accomplish this in Word 2007? Else: are there any other free tools to do this? I also want to add some other shapes. Again: I want to accomplish a star-like structure with a total of 4 depth levels. Thanks for your responses in advance!

    Read the article

  • Solid Edge ST6 - 2D Modeling: dimensions

    - by juFo
    I'm currently making some 2D drawings in Solid Edge ST6. I have several circles which I need to change so that they have an equal diameter and equal space between both circles, etc... Currently my drawing looks a bit messy with all the dimensions that I use: I use the Smart Dimension tool and the Distance Between tool but I have no clue to make my drawing more readable by adding less dimensions. Is there a way to copy/paste dimensions or let a circle follow the dimensions of one other circle? I hope you understand the question. Thanks in advance (I could not find anything about Solid Edge, so I hope superuser is the correct place to ask.)

    Read the article

  • How to implement friction in a physics engine based on "Advanced Character Physics"

    - by paldepind
    I have implemented a physics engine based on the concepts in the classic text Advanced Character Physics by Thomas Jakobsen. Friction is only discussed very briefly in the article and Jakobsen himself notes how "other and better friction models than this could and should be implemented." Generally how could one implement a believable friction model on top of the concepts from the mentioned article? And how could the found friction be translated into rotation on a circle? I do not want this question to be about my specific implementation but about how to combine Jakobsens ideas with a great friction system more generally. But here is a live demo showing the current state of my engine which does not handle friction in any way: http://jsfiddle.net/Z7ECB/embedded/result/ Below is a picture showing and example on how collision detection could work in an engine based in the paper. In the Verlet integration the current and previous position is always stored. Based on these a new position is calculated. In every frame I calculate the distance between the circles and the lines. If this distance is less than a circles radius a collision has occurred and the circle is projected perpendicular out of the offending line according to the size of the overlap (offset on the picture). Velocity is implicit due to Verlet integration so changing position also changes the velocity. What I need to do know is to somehow determine the amount of friction on the circle and move it backwards parallel to the line in order to reduce its speed.

    Read the article

  • Wrong perspective is showing in Eclipse plugin project [closed]

    - by Arun Kumar Choudhary
    I am working in Eclipse Modeling Framework (Eclipse plugin development) in my project the tool(project i am working) provides three perspectives. 1.Accelerator Analyst perspective 2.Contract Validation and 3.Underwriter rules Editor... By default it starts with Contract validation perspective (As we define it within the plugin_customization.ini). However after switching to other perspective does not change the perspective shown... As all perspective (Class, Id and Name) is define only inside Plugin.XML as it is the task of org.eclipse.ui.perspective that that perspective name should be come forefront. Out of 10 7 times it is working fine but I am not getting why this is not working in that 3 cases. I am pasting my plugin.XML file <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin> <extension id="RuleEditor.application" name="Accelerator Tooling" point="org.eclipse.core.runtime.applications"> <application> <run class="com.csc.fs.underwriting.product.UnderWritingApplication"> </run> </application> </extension> <extension point="org.eclipse.ui.perspectives"> <perspective class="com.csc.fs.underwriting.product.ContractValidationPerspective" icon="icons/javadevhov_obj.gif" id="com.csc.fs.underwriting.product.ContractValidationPerspective" name="Contract Validation"> </perspective> </extension> <extension point="org.eclipse.ui.perspectives"> <perspective class="com.csc.fs.underwriting.product.UnderwritingPerspective" icon="icons/javadevhov_obj.gif" id="com.csc.fs.underwriting.product.UnderwritingPerspective" name="Underwriting"> </perspective> </extension> <extension id="product" point="org.eclipse.core.runtime.products"> <product application="com.csc.fs.nba.underwriting.application.RuleEditor.application" name="Rule Configurator Workbench" description="%AppName"> <property name="introTitle" value="Welcome to Accelerator Tooling"/> <property name="introVer" value="%version"/> <property name="introBrandingImage" value="product:csclogo.png"/> <property name="introBrandingImageText" value="CSC FSG"/> <property name="preferenceCustomization" value="plugin_customization.ini"/> <property name="appName" value="Rule Configurator Workbench"> </property> </product> </extension> <extension point="org.eclipse.ui.intro"> <intro class="org.eclipse.ui.intro.config.CustomizableIntroPart" icon="icons/Welcome.gif" id="com.csc.fs.nba.underwriting.intro"/> <introProductBinding introId="com.csc.fs.nba.underwriting.intro" productId="com.csc.fs.nba.underwriting.application.product"/> <intro class="org.eclipse.ui.intro.config.CustomizableIntroPart" id="com.csc.fs.nba.underwriting.application.intro"> </intro> <introProductBinding introId="com.csc.fs.nba.underwriting.application.intro" productId="com.csc.fs.nba.underwriting.application.product"> </introProductBinding> </extension> <extension name="Accelerator Tooling" point="org.eclipse.ui.intro.config"> <config content="$nl$/intro/introContent.xml" id="org.eclipse.platform.introConfig.mytest" introId="com.csc.fs.nba.underwriting.intro"> <presentation home-page-id="news"> <implementation kind="html" os="win32,linux,macosx" style="$nl$/intro/css/shared.css"/> </presentation> </config> <config content="introContent.xml" id="com.csc.fs.nba.underwriting.application.introConfigId" introId="com.csc.fs.nba.underwriting.application.intro"> <presentation home-page-id="root"> <implementation kind="html" os="win32,linux,macosx" style="content/shared.css"> </implementation> </presentation> </config> </extension> <extension point="org.eclipse.ui.intro.configExtension"> <theme default="true" id="org.eclipse.ui.intro.universal.circles" name="%theme.name.circles" path="$nl$/themes/circles" previewImage="themes/circles/preview.png"> <property name="introTitle" value="Accelerator Tooling"/> <property name="introVer" value="%version"/> </theme> </extension> <extension point="org.eclipse.ui.ide.resourceFilters"> <filter pattern="*.dependency" selected="true"/> <filter pattern="*.producteditor" selected="true"/> <filter pattern="*.av" selected="true"/> <filter pattern=".*" selected="true"/> </extension> <extension point="org.eclipse.ui.splashHandlers"> <splashHandler class="com.csc.fs.nba.underwriting.application.splashHandlers.InteractiveSplashHandler" id="com.csc.fs.nba.underwriting.application.splashHandlers.interactive"> </splashHandler> <splashHandler class="com.csc.fs.underwriting.application.splashHandlers.InteractiveSplashHandler" id="com.csc.fs.underwriting.application.splashHandlers.interactive"> </splashHandler> <splashHandlerProductBinding productId="com.csc.fs.nba.underwriting.application" splashId="com.csc.fs.underwriting.application.splashHandlers.interactive"> </splashHandlerProductBinding> </extension> <extension id="com.csc.fs.pa.security" point="com.csc.fs.pa.security.implementation.secure"> <securityImplementation class="com.csc.fs.pa.security.PASecurityImpl"> </securityImplementation> </extension> <extension id="productApplication.security.pep" name="com.csc.fs.pa.producteditor.application.security.pep" point="com.csc.fs.pa.security.implementation.authorize"> <authorizationManager class="com.csc.fs.pa.security.authorization.PAAuthorizationManager"> </authorizationManager> </extension> <extension point="org.eclipse.ui.editors"> <editor class="com.csc.fs.underwriting.product.editors.PDFViewer" extensions="pdf" icon="icons/pdficon_small.gif" id="com.csc.fs.pa.producteditor.application.editors.PDFViewer" name="PDF Viewer"> </editor> </extension> <extension point="org.eclipse.ui.views"> <category id="com.csc.fs.pa.application.viewCategory" name="%category"> </category> </extension> <extension point="org.eclipse.ui.newWizards"> <category id="com.csc.fs.pa.application.newWizardCategory" name="%category"> </category> <category id="com.csc.fs.pa.application.newWizardInitialize" name="%initialize" parentCategory="com.csc.fs.pa.application.newWizardCategory"> </category> </extension> <extension point="com.csc.fs.pa.common.usability.addNewCategory"> <addNewCategoryId id="com.csc.fs.pa.application.newWizardCategory"> </addNewCategoryId> </extension> <!--extension point="org.eclipse.ui.activities"> <activity description="View Code Generation Option" id="com.csc.fs.pa.producteditor.application.viewCodeGen" name="ViewCodeGen"> </activity> <activityPatternBinding activityId="com.csc.fs.pa.producteditor.application.viewCodeGen" pattern="com.csc.fs.pa.bpd.vpms.codegen/com.csc.fs.pa.bpd.vpms.codegen.bpdCodeGenActionId"> </activityPatternBinding> Add New Product Definition Extension </extension--> </plugin> class="com.csc.fs.underwriting.product.editors.PDFViewer" extensions="pdf" icon="icons/pdficon_small.gif" id="com.csc.fs.pa.producteditor.application.editors.PDFViewer" name="PDF Viewer"> </editor> </extension> <extension point="org.eclipse.ui.views"> <category id="com.csc.fs.pa.application.viewCategory" name="%category"> </category> </extension> <extension point="org.eclipse.ui.newWizards"> <category id="com.csc.fs.pa.application.newWizardCategory" name="%category"> </category> <category id="com.csc.fs.pa.application.newWizardInitialize" name="%initialize" parentCategory="com.csc.fs.pa.application.newWizardCategory"> </category> </extension> <extension point="com.csc.fs.pa.common.usability.addNewCategory"> <addNewCategoryId id="com.csc.fs.pa.application.newWizardCategory"> </addNewCategoryId> </extension> <!--extension point="org.eclipse.ui.activities"> <activity description="View Code Generation Option" id="com.csc.fs.pa.producteditor.application.viewCodeGen" name="ViewCodeGen"> </activity> <activityPatternBinding activityId="com.csc.fs.pa.producteditor.application.viewCodeGen" pattern="com.csc.fs.pa.bpd.vpms.codegen/com.csc.fs.pa.bpd.vpms.codegen.bpdCodeGenActionId"> </activityPatternBinding> Add New Product Definition Extension </extension--> </plugin> Inside each class(the qualified classes in above xml) i did only hide and show the view according to perspective and that is working very fine.. Please provide any method that Eclipse provide so that I can override it in each classed so that it can work accordingly.

    Read the article

  • Great Debugging skills weak problem solving

    - by Mahmoud
    For the 5 years I worked for various companies, I worked in large software like computer vision kits, embedded, games. I found myself very good at debuggins skills, I've even found and fixed bugs in frameworks and I solved them. The problem is that I'm very weak at problem solving. I got interview with Qualcomm, and they said you're fine at software, but you have a limited problem solving, I also had the same results with Google. I'm very bad at solving puzzles and brain teasers. During the interviews I solve all of the software related problems on the blackboard, but when I went to the GM and face math problems and probabilities, I struggle. How can I improve my problem solving skills? Edit Some of the problems: A cake that is cut from anywhere and needs just one cut to halved in equal. I told him cut it horizontally, he said No, consider it as a 2D Problem!. Consider a concenteric 3 circles, each one can get a color, but not matched with the other circle, how many blobs you can make out of those circles ? this was with the GM ( Augmented Reality SDK) Consider a train, an infinite one, and you looked at the window, and there are two cars, one big, and one small, what is the probability of having only a big car, I said 50%, he said, what if that two cars you dont know their length, and you want to get the probability of getting the biggest one, I struggled, didn't solve it... I was really exahusted after long day of interviews prob of having a number divisible by 5 in numbers from 1 to 100.. struggled!! All coding questions I solved them like reverse a string, detect a cycle in a linked list,..etc.

    Read the article

  • Happy Tau Day! (Or: How Some Mathematicians Think We Should Retire Pi) [Video]

    - by Jason Fitzpatrick
    When you were in school you learned all about Pi and its relationship to circles and turn-based geometry. Some mathematicians are rallying for a new lesson, on about Tau. Michael Hartl is a mathematician on a mission, a mission to get people away from using Pi and to start using Tau. His manifesto opens: Welcome to The Tau Manifesto. This manifesto is dedicated to one of the most important numbers in mathematics, perhaps the most important: the circle constant relating the circumference of a circle to its linear dimension. For millennia, the circle has been considered the most perfect of shapes, and the circle constant captures the geometry of the circle in a single number. Of course, the traditional choice of circle constant is p—but, as mathematician Bob Palais notes in his delightful article “p Is Wrong!”,1 p is wrong. It’s time to set things right. Why is Pi wrong? Among the arguments is that Tau is the ration of a circumference to the radius of a circle and defining circles by their radius is more natural and that Pi is a 2-factor number but with Tau everything is based of a single unit–three quarters of a turn around a Tau-defined circle is simply three quarters of a Tau radian. Watch the video above to see the Tau sequence (which begins 6.2831853071…) turned into a musical composition. For more information about Tau hit up the link below to read the manifesto. The Tau Manifesto [TauDay] HTG Explains: Photography with Film-Based CamerasHow to Clean Your Dirty Smartphone (Without Breaking Something)What is a Histogram, and How Can I Use it to Improve My Photos?

    Read the article

  • Circle collision detection and Vector math: HELP?

    - by Griffin
    Hey so i'm currently going through the wildbunny blog to learn about collision detection, but i'm a bit confused on how the vectors he's talking about come into play QUOTED BLOG: p = ||A-B|| – (r1+r2) The two spheres are penetrating by distance p. We would also like the penetration vector so that we can correct the penetration once we discover it. This is the vector that moves both circles to the point where they just touch, correcting the penetration. Importantly it is not only just a vector that does this, it is the only vector which corrects the penetration by moving the minimum amount. This is important because we only want to correct the error, not introduce more by moving too much when we correct, or too little. N = (A-B) / ||A-B|| P = N*p Here we have calculated the normalised vector N between the two centres and the penetration vector P by multiplying our unit direction by the penetration distance. Ok so i understand that p is the distance each circle is penetrating each other, but i don't get what exactly N and P is. it seems to me N is just the coordinates of the 3rd point of the right trianlge formed by point A and B (A-B) then being divided by the hypotenuse of that triangle or distance between A and B (||A-B||) Whats the significance of this? Also, what is the penetration vector used for? It seems to me like a movement that one of the circles would perform to get un-penetrated.

    Read the article

  • Disappearring instances of VertexPositionColor using MonoGame

    - by Rosko
    I am a complete beginner in graphics developing with XNA/Monogame. Started my own project using Monogame 3.0 for WinRT. I have this unexplainable issue that some of the vertices disappear while doing some updates on them. Basically, it is a game with balls who collide with the walls and with each other and in certain conditions they explode. When they explode they disappear. Here is a video demonstrating the issue. I used wireframes so that it is easier to see how vertices are missing. The perfect exploding balls are the ones which are result by user input with mouse clicking. Thanks for the help. The situations is: I draw user primitives with triangle strips using like this graphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, circleVertices, 0, primitiveCount); All of the primitives are in the z-plane (z = 0), I thought that it is the culling in action. I tried setting the culling mode to none but it did not help. Here is the code responsible for the explosion private void Explode(GameTime gameTime, ref List<Circle> circles) { if (this.isExploding) { for (int i = 0; i < this.circleVertices.Length; i++) { if (this.circleVertices[i] != this.circleCenter) { if (Vector3.Distance(this.circleVertices[i].Position, this.circleCenter.Position) < this.explosionRadius * precisionCoefficient) { var explosionVector = this.circleVertices[i].Position - this.circleCenter.Position; explosionVector.Normalize(); explosionVector *= explosionSpeed; circleVertices[i].Position += explosionVector * (float)gameTime.ElapsedGameTime.TotalSeconds; } else { circles.Remove(this); } } } } } I'd be really greatful if anyone has suggestions about how to fix this issue.

    Read the article

  • Spritegroups and colorkeys

    - by Fristi
    I have a problem using spritegroups in pygame. In my situation I have 2 spritegroups, one for humans, one for "infected". A human is represented by a blue circle: image = pygame.Surface((32,32)) image.fill((255,255,255)) pygame.draw.circle(image,(0,0,255),(16,16),16) image = image.convert() image.set_colorkey((255,255,255)) An infected by a red one (same code, different color). I update my spritegroups as follows: self.humans.clear(self.screen, self.bg) self.humans.update(time_passed) self.humans.draw(self.screen) self.infected.clear(self.screen, self.bg) self.infected.update(time_passed) self.infected.draw(self.screen) Self.bg is defined: self.bg = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT)) self.bg.fill((255,255,255)) self.bg.convert() This all works, except that when a red circle overlaps with a blue one, you can see the white corners of the bounding box around the actual circle. Within a spritegroup it works, using the set_colorkey function. This does not happen with overlapping blue circles or overlapping red circles. I tried adding a colorkey to self.bg but that did not work. Same for adding a colorkey to self.screen.

    Read the article

  • How to handle circle penetration

    - by Kaertserif
    I've been working on cirlce to circle collision and have gotten the intersection method working correctly, but I'm having problems using the returned values to actually seperate the circles from one another. This is the method which calculates the depth of the circle collision public static Vector2 GetIntersectionDepth(Circle a, Circle b) { float xValue = a.Center.X - b.Center.X; float yValue = a.Center.Y - b.Center.Y; Vector2 depth = Vector2.Zero; float distance = Vector2.Distance(a.Center, b.Center); if (a.Radius + b.Radius > distance) { float result = (a.Radius + b.Radius) - distance; depth.X = (float)Math.Cos(result); depth.Y = (float)Math.Sin(result); } return depth; } This is where I'm trying to apply the values to actually seperate the circles. Vector2 depth = Vector2.Zero; for (int i = 0; i < circlePositions.Count; i++) { for (int j = 0; j < circlePositions.Count; j++) { Circle bounds1 = new Circle(circlePositions[i], circle.Width / 2); Circle bounds2 = new Circle(circlePositions[j], circle.Width / 2); if(i != j) depth = CircleToCircleIntersection.GetIntersectionDepth(bounds1, bounds2); if (depth != Vector2.Zero) { circlePositions[i] = new Vector2(circlePositions[i].X + depth.X, circlePositions[i].Y + depth.Y); } } } If you can offer any help in this I would really appreciate it.

    Read the article

  • UIButton: Need a circle hit area

    - by Pavan
    Ok I have 6 custom UIButtons. Their normal state image are all circles images. They are all spaced out equally but all the circles touch each other. The problem with the custom UIbutton (which has a circle image on it), is that the hit area of that button is square, and the corners of this square overlaps the hitarea of the other custom button's hitarea. How do i make the hit area of a UIbutton whos normal state has a circle image, be only clickable on that circle only, rather than the normal square hit area?! I hope that someone can find a way for me to solve this problem that i currently am having! Thanks in advance Pavan

    Read the article

  • custom button: properties change, button should be redrawn

    - by Rutger
    Hi I'm developing an Android app. I have class derived from button to represent a special type of button. This special type has some properties (integers) and according to these one or more circles have to be drawn on top of the button. So I overrode the onDraw function, which looks the values up and accordingly draws the circles. But the class has a function to set new values for its properties. So new values are set but the changes are not reflected in the UI. It seems like the onDraw function is not called. When later I click the button or show a pop up message above my interface the onDraw function is called and the button is drawn correctly. So my question: when changing the properties how can I say that the button has to be redrawn? Thanks a lot!

    Read the article

  • Bounding Boxes for Circle and Arcs in 3D

    - by David Rutten
    Given curves of type Circle and Circular-Arc in 3D space, what is a good way to compute accurate bounding boxes (world axis aligned)? Edit: found solution for circles, still need help with Arcs. C# snippet for solving BoundingBoxes for Circles: public static BoundingBox CircleBBox(Circle circle) { Point3d O = circle.Center; Vector3d N = circle.Normal; double ax = Angle(N, new Vector3d(1,0,0)); double ay = Angle(N, new Vector3d(0,1,0)); double az = Angle(N, new Vector3d(0,0,1)); Vector3d R = new Vector3d(Math.Sin(ax), Math.Sin(ay), Math.Sin(az)); R *= circle.Radius; return new BoundingBox(O - R, O + R); } private static double Angle(Vector3d A, Vector3d B) { double dP = A * B; if (dP <= -1.0) { return Math.PI; } if (dP >= +1.0) { return 0.0; } return Math.Acos(dP); }

    Read the article

  • JQuery UI Drop Disable on selected elements

    - by Suneth Kalhara
    i want to add drop limit on circles, i wrote a scrit for dragging circles the problem is user can drop circle on another circle, i don't want to allow it, simply i need to revert if the user drag and drop circle on another circle. i write some codes for this. but this not working for me, it always revert the dropped circle. here is my example url http://webxtreams.net/demoprofiles004/circledragger.html here is js code i run on fire bug $(".circle").draggable({ revert: 'invalid' }); $(".circle").droppable({ accept: function(el) { return el.hasClass('.circle'); } }); please help me to do that. have another little question - can we track the reverting event on this, i need to repaint the lines when reverting the circle :)

    Read the article

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