Search Results

Search found 776 results on 32 pages for 'rounded corners'.

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

  • How To Use Windows 8's Gestures on a Laptop Trackpad

    - by Chris Hoffman
    While Windows 8 may seem a bit out of place on hardware without a touch screen, trackpad gestures can help bridge the gap. Gestures on a trackpad work similarly to gestures on a touch screen. Instead of moving the cursor to the corners of the screen, you can swipe the trackpad to reveal hidden menus and pinch your fingers to zoom in and out. Image Credit: Michael Mol on Flickr 7 Ways To Free Up Hard Disk Space On Windows HTG Explains: How System Restore Works in Windows HTG Explains: How Antivirus Software Works

    Read the article

  • Circle-Rectangle collision in a tile map game

    - by furiousd
    I am making a 2D tile map based putt-putt game. I have collision detection working between the ball and the walls of the map, although when the ball collides at the meeting point between 2 tiles I offset it by 0.5 so that it doesn't get stuck in the wall. This aint a huge issue though. if(y % 20 == 0) { y+=0.5; } if(x % 20 == 0) { x+=0.5; } Collisions work as follows Find the closest point between each tile and the center of the ball If distance(ball_x, ball_y, close_x, close_y) <= ball_radius and the closest point belongs to a solid object, collision has occured Invert X/Y speed according to side of object collided with The next thing I tried to do was implement floating blocks in the middle of the map for the ball to bounce off of. When a ball collides with a corner of the block, it gets stuck in it. So I changed my determineRebound() function to treat corners as if they were circles. Here's that functon: `i and j are indexes of the solid object in the 2d map array. x & y are centre point of ball.` void determineRebound(int _i, int _j) { if(y > _i*tile_w && y < _i*tile_w + tile_w) { //Not a corner xs*=-1; } else if(x > _j*tile_w && x < _j*tile_w + tile_w) { //Not a corner ys*=-1; } else { //Corner float nx = x - close_x; float ny = y - close_y; float len = sqrt(nx * nx + ny * ny); nx /= len; ny /= len; float projection = xs * nx + ys * ny; xs -= 2 * projection * nx; ys -= 2 * projection * ny; } } This is where things have gotten messy. Collisions with 'floating' corners work fine, but now when the ball collides near the meeting point of 2 tiles, it detects a corner collision and does not rebound as expected. I'm a bit in over my head at this point. I guess I'm wondering if I'm going about making this sort of game in the right way. Is a 2d tile map the way to go? If so, is there a problem with my collision logic and where am I going wrong? Any advice/feedback would be great.

    Read the article

  • Designs For Emerald Cut Rings

    Step Cut type of the emerald cut stones appears to be like steps engraved into the jewel. Particularly, emerald cutting was rectangular in shape with little cropped corners. At first, this cut was bu... [Author: Scheygen Smith - Computers and Internet - March 21, 2010]

    Read the article

  • Intersection points of plane set forming convex hull

    - by Toji
    Mostly looking for a nudge in the right direction here. Given a set of planes (defined as a normal and distance from origin) that form a convex hull, I would like to find the intersection points that form the corners of that hull. More directly, I'm looking for a way to generate a point cloud appropriate to provide to Bullet. Bonus points if someone knows of a way I could give bullet the plane list directly, since I somewhat suspect that's what it's building on the backend anyway.

    Read the article

  • Ugly right-click menu and menubar in some applications

    - by halflings
    After installing some packages (unfortunately I can't remember which ones) and installing some GTK3 themes (Faience / Faenza), my terminal's menubar and the right-click menu (in some contexts) started to look very ugly ! 1: Right-click menu 2: Terminal menubar, notice the white rounded corner rectangles, it looks WAY uglier on other themes Note that the menubar isn't "ugly" in most contexts, but it still is on the desktops and some applications. (For the menubar, I think the terminal is the only one concerned by this) I tried going back to my original theme, it didn't fix the problem.

    Read the article

  • Answer programming for "What are your interests?" interview questions?

    - by Morgan Herlocker
    For interview questions that ask for personal hobbies, should you mention a bunch of tech activities you enjoy, like how "I love building java applets in my free time" or should you focus on non-programming activities to show you are well rounded? Does it show passion to say programming is a hobby, or does it sound disingenuous? I could see it going either way, so please back up your answer with some sound reasoning.

    Read the article

  • Using CSS3 is a bad practice? [closed]

    - by Qmal
    Possible Duplicate: Should I use HTML5 and/or CSS3 to build my website? I just want to know if it's considered as a "bad practice" to use things like rounded corners, gradients and so on... I understand that there are bots and crawlers that do not process CSS, but they don't need to. And nowadays most people use browsers that can process CSS3 with no problem. So should I make my buttons and shadows and such look pretty with CSS3 or with images?

    Read the article

  • QotD: Maurizio Cimadamore on Project Lambda Binary Snapshots

    - by $utils.escapeXML($entry.author)
    I'm glad to announce that the first binary snapshots of the lambda repository are available at the following URL:http://jdk8.java.net/lambda/As you can imagine, as the implementation of the compiler/libraries is still under heavy development, there are still many rough corners that need to be polished. I'd like to thank you all for all the patience and the valuable feedback provided so far - please keep it coming!Maurizio Cimadamore announcing the Project Lambda binary snapshots on the lambda-dev OpenJDK mailing list.

    Read the article

  • How to Modify Caching Behavior in Internet Explorer 10

    - by Taylor Gibb
    Caching is term used a lot when it comes to technology, here’s a brief introduction to the subject as well as some tips on how to view and edit cached file settings in Internet Explorer. What Is the Purpose of the “Do Not Cover This Hole” Hole on Hard Drives? How To Log Into The Desktop, Add a Start Menu, and Disable Hot Corners in Windows 8 HTG Explains: Why You Shouldn’t Use a Task Killer On Android

    Read the article

  • Beginner Geek: How to Stop Websites From Requesting Your Location in the Metro Internet Explorer

    - by Taylor Gibb
    These days nearly every website on the web is trying to gather every piece of information they can about you and your browsing habits. Here’s how you can prevent them from getting perhaps the most sensitive piece of information, your physical location, while browsing the web in the Metro IE. 6 Start Menu Replacements for Windows 8 What Is the Purpose of the “Do Not Cover This Hole” Hole on Hard Drives? How To Log Into The Desktop, Add a Start Menu, and Disable Hot Corners in Windows 8

    Read the article

  • How to Make Windows 8 Index Encrypted Files

    - by Taylor Gibb
    If you have files that are encrypted with the Encrypting File System, you will probably have noticed that they don’t get indexed by Windows, and therefore don’t show up in search results. Here’s how to fix that. 6 Start Menu Replacements for Windows 8 What Is the Purpose of the “Do Not Cover This Hole” Hole on Hard Drives? How To Log Into The Desktop, Add a Start Menu, and Disable Hot Corners in Windows 8

    Read the article

  • Compiz shortcut with two arrow keys

    - by l0b0
    The "Put" functionality of CompizConfig Settings Manager is great. I'd like to be able to move windows to the desktop corners by using Super+Down/Up+Left/Right for this; is that possible? Whenever I try to set something like that it is just reset to "Disabled". A workaround is of course to use the numeric pad, but I'd like to be able to do this on my EEE laptop as well without enabling and disabling NumLock all the time.

    Read the article

  • CodePlex Daily Summary for Sunday, April 11, 2010

    CodePlex Daily Summary for Sunday, April 11, 2010New ProjectsArkzia: This Silverlight game.CodePlex Wiki Editor: CodePlex Wiki Editor makes it easier for CodePlex users to create their wiki documentations. This project offer a rich interface for the edition...Evaluate: Evaluate & Comet DWR like .NET library with powerfull Evaluate and Ajax Comet support. Also, you may use Evaluate library in your own .Net applicat...FamAccountor: 家庭记账薄Horadric: This is common tools freamwork!K8061.Managed: This is a solution to use the Velleman Extended K8061 USB Interface board with .net and to have a nice wrapper handling most of the overhead for us...Latent semantic analysis: all you need is to use!: Baggr is feed aggregator with web interface, user rating and LSA filter. Enjoy it!LIF7 ==> RISK : TOWER DEFENSE: Université Lyon 1, L2 MATH-INFO 2009-2010 Semestre de printemps Projet RISK : TOWER DEFENSE Membres : Jessica El Melhem, Vincent Sébille, et Jonat...Managed ESL Suite: Managed ESL Suite using C# for FreeSWITCH Omni-Tool - A program version concept of the tool used in Mass Effect.: A program version concept of the tool used in Mass Effect. It will support little apps (plugins) that run inside the UI. Its talor mainly at develo...PdxCodeCamp: Web application for Portland Code CampProjeto Vírus: Desenvolvimento do Jogo Virus em XNAsilverlight control - stars with rounded corners: Draw stars and cogs including rounded cornersSilverlight MathParser: Implementation of mathematical expressions parser to compute and functions.turing machine simulator: Project for JCE in course SW engeenering. Turing Machine simulator with GUI.WpD - Wallpapers Downloader: You can easy download wallpapers to your computer without any advertising or registration. On 5 minutes you can download so many wallpapers!New ReleasesAJAX Control Framework: v1.0.0.0: New AJAX project that helps you create AJAX enabled controls. Make use of control level AJAX methods, a Script Manager that works like you'd expect...AutoFixture: Version 1.1: This is version 1.1 of AutoFixture. This release contains no known bugs. Compared to Release Candidate 1 for version 1.1, there are no changes. Ho...AutoPoco: AutoPoco 0.3: Method Invocation in configuration Custom type providers during configuration Method invocation for generationBacicworx (Basic Services Framework): 3.0.10.410 (Beta): Major update, winnowing, and recode of the library. Removed redundant classses and methods which have similar functionality to those available in ...Bluetooth Radar: Version 1.5: Mostly UI and Animation Changes.BUtil: BUtil 4.9: 1. Icons of kneo are almost removed 2. Deployment was moved to codeplex.com 3. Adding of storages was unavailable when any of storages are used FIXEDcrudwork library: crudwork 2.2.0.3: few bug fixes new object viewer - allow the user to view and change an object through the property grid and/or the simple XML editor pivot table ...EnhSim: Release v1.9.8.5: Release v1.9.8.5Removed the debugging output from the Armor Penetration change.EnhSim: Release v1.9.8.6: Release v1.9.8.6Updated release to include the correct version of EnhSimGUIEvaluate: Evaluate Library: This file contains Evaluate library source code under Visual Studio project. Also, there is a sample project to see the use.ExcelDna: ExcelDna Version 0.25: This is an important bugfix release, with the following changes: Fix case where unpacked .config temp file might not be deleted. Fix compiler pro...FamAccountor: 家庭账薄 预览版v0.0.1: 家庭账薄 预览版v0.0.1 该版本提供基本功能,还有待扩展! Feature: 实现基本添加、编辑、删除功能。FamAccountor: 家庭账薄 预览版v0.0.2: 家庭账薄 预览版v0.0.2 该版本提供基本功能,还有待扩展! Feature: 添加账户管理功能。Folder Bookmarks: Folder Bookmarks 1.4.2: This is the latest version of Folder Bookmarks (1.4.2), with general improvements. It has an installer - it will create a directory 'CPascoe' in My...GKO Libraries: GKO Libraries 0.3 Beta: Added Silverlight support for Gko.Utils Added ExtensionsHash Calculator: HashCalculator 1.2: HashCalculator 1.2HD-Trailers.NET Downloader: Version: TrailersOnly if set to 'true' only titles with 'trailer' in the title will be download MinTrailerSize Added a minimum trailer size, this avoids t...Home Access Plus+: v3.2.6.0: v3.2.5.1 Release Change Log: Add lesson naming Fixed a bug in the help desk which was rendering the wrong URL for tickets Planning has started ...HTML Ruby: 6.20.0: All new concept, all new code. Because this release does not support complex ruby annotations, "Furigana Injector" is not supported by this release...HTML Ruby: 6.20.1: Fixed problem where ruby with closed tags but no rb tag will result in empty page Added support for complex ruby annotation (limited single ruby)...K8061.Managed: K8061.Managed: This is a pre-compilled K8061.Managed.DLL file release 1.0.Kooboo CMS: Kooboo CMS 2.1.0.0: Users of Kooboo CMS 2.0, please use the "Check updates" feature under System to upgrade New featuresWebDav support You can now use tools like w...Kooboo forum: Kooboo Forum Module for 2.1.0.0: Compatible with Kooboo cms 2.1.0.0 Upgrade to MVC 2Kooboo GoogleAnalytics: Kooboo GoogleAnalytics Module for 2.1.0.0: Compatible with Kooboo cms 2.1.0.0 Upgrade to MVC 2Kooboo wiki: Kooboo CMS Wiki module for 2.1.0.0: Compatible with Kooboo cms 2.1.0.0 Upgrade to MVC 2Mavention: Mavention Simple SiteMapPath: Mavention Simple SiteMapPath is a custom control that renders breadcrumbs as an unordered list what makes it a perfect solution for breadcrumbs on ...MetaSharp: MetaSharp v0.3: MetaSharp v0.3 Roadmap: Oslo Independence Custom Grammar library Improved build environment dogfooding Project structure simplificationsRoTwee: RoTwee (10.0.0.7): New feature of this version is support for mouse wheel. You can rotate tweets rotating mouse wheel.silverlight control - stars with rounded corners: first step: These are the first examples.Silverlight MathParser: Silverlight MathParser 1.0: Implementation of mathematical expressions parser to compute and functions.SimpleGeo.NET: SimpleGeo.NET example website project: ConfigurationYou must change these three configuration values in AppSettings.config: Google Maps API key: for the maps on the test site. Get one he...StickyTweets: 0.6.0: Version 0.6.0 Code - PERFORMANCE Hook into Async WinInet to perform async requests without adding an additional thread Code - Verify that async r...System.Html: Version 1.3; fixed bugs and improved performance: This release incorporates bug fixes, a new normalize method proposed by RudolfHenning of Codeplex.VCC: Latest build, v2.1.30410.0: Automatic drop of latest buildVFPX: FoxTabs 0.9.2: The following issues were addressed: 26744 24954 24767Visual Studio DSite: Advanced Guessing Number Game (Visual C++ 2008): A guessing number game made in visual c 2008.WpD - Wallpapers Downloader: WpD v0.1: My first release, I hope you enjoyMost Popular ProjectsWBFS ManagerRawrASP.NET Ajax LibraryMicrosoft SQL Server Product Samples: DatabaseAJAX Control ToolkitSilverlight ToolkitWindows Presentation Foundation (WPF)ASP.NETMicrosoft SQL Server Community & SamplesFacebook Developer ToolkitMost Active ProjectsRawrnopCommerce. Open Source online shop e-commerce solution.AutoPocopatterns & practices – Enterprise LibraryShweet: SharePoint 2010 Team Messaging built with PexFarseer Physics EngineNB_Store - Free DotNetNuke Ecommerce Catalog ModuleIonics Isapi Rewrite FilterBlogEngine.NETBeanProxy

    Read the article

  • Point inside Oriented Bounding Box?

    - by Milo
    I have an OBB2D class based on SAT. This is my point in OBB method: public boolean pointInside(float x, float y) { float newy = (float) (Math.sin(angle) * (y - center.y) + Math.cos(angle) * (x - center.x)); float newx = (float) (Math.cos(angle) * (x - center.x) - Math.sin(angle) * (y - center.y)); return (newy > center.y - (getHeight() / 2)) && (newy < center.y + (getHeight() / 2)) && (newx > center.x - (getWidth() / 2)) && (newx < center.x + (getWidth() / 2)); } public boolean pointInside(Vector2D v) { return pointInside(v.x,v.y); } Here is the rest of the class; the parts that pertain: public class OBB2D { private Vector2D projVec = new Vector2D(); private static Vector2D projAVec = new Vector2D(); private static Vector2D projBVec = new Vector2D(); private static Vector2D tempNormal = new Vector2D(); private Vector2D deltaVec = new Vector2D(); private ArrayList<Vector2D> collisionPoints = new ArrayList<Vector2D>(); // Corners of the box, where 0 is the lower left. private Vector2D corner[] = new Vector2D[4]; private Vector2D center = new Vector2D(); private Vector2D extents = new Vector2D(); private RectF boundingRect = new RectF(); private float angle; //Two edges of the box extended away from corner[0]. private Vector2D axis[] = new Vector2D[2]; private double origin[] = new double[2]; public OBB2D(float centerx, float centery, float w, float h, float angle) { for(int i = 0; i < corner.length; ++i) { corner[i] = new Vector2D(); } for(int i = 0; i < axis.length; ++i) { axis[i] = new Vector2D(); } set(centerx,centery,w,h,angle); } public OBB2D(float left, float top, float width, float height) { for(int i = 0; i < corner.length; ++i) { corner[i] = new Vector2D(); } for(int i = 0; i < axis.length; ++i) { axis[i] = new Vector2D(); } set(left + (width / 2), top + (height / 2),width,height,0.0f); } public void set(float centerx,float centery,float w, float h,float angle) { float vxx = (float)Math.cos(angle); float vxy = (float)Math.sin(angle); float vyx = (float)-Math.sin(angle); float vyy = (float)Math.cos(angle); vxx *= w / 2; vxy *= (w / 2); vyx *= (h / 2); vyy *= (h / 2); corner[0].x = centerx - vxx - vyx; corner[0].y = centery - vxy - vyy; corner[1].x = centerx + vxx - vyx; corner[1].y = centery + vxy - vyy; corner[2].x = centerx + vxx + vyx; corner[2].y = centery + vxy + vyy; corner[3].x = centerx - vxx + vyx; corner[3].y = centery - vxy + vyy; this.center.x = centerx; this.center.y = centery; this.angle = angle; computeAxes(); extents.x = w / 2; extents.y = h / 2; computeBoundingRect(); } //Updates the axes after the corners move. Assumes the //corners actually form a rectangle. private void computeAxes() { axis[0].x = corner[1].x - corner[0].x; axis[0].y = corner[1].y - corner[0].y; axis[1].x = corner[3].x - corner[0].x; axis[1].y = corner[3].y - corner[0].y; // Make the length of each axis 1/edge length so we know any // dot product must be less than 1 to fall within the edge. for (int a = 0; a < axis.length; ++a) { float l = axis[a].length(); float ll = l * l; axis[a].x = axis[a].x / ll; axis[a].y = axis[a].y / ll; origin[a] = corner[0].dot(axis[a]); } } public void computeBoundingRect() { boundingRect.left = JMath.min(JMath.min(corner[0].x, corner[3].x), JMath.min(corner[1].x, corner[2].x)); boundingRect.top = JMath.min(JMath.min(corner[0].y, corner[1].y),JMath.min(corner[2].y, corner[3].y)); boundingRect.right = JMath.max(JMath.max(corner[1].x, corner[2].x), JMath.max(corner[0].x, corner[3].x)); boundingRect.bottom = JMath.max(JMath.max(corner[2].y, corner[3].y),JMath.max(corner[0].y, corner[1].y)); } public void set(RectF rect) { set(rect.centerX(),rect.centerY(),rect.width(),rect.height(),0.0f); } // Returns true if other overlaps one dimension of this. private boolean overlaps1Way(OBB2D other) { for (int a = 0; a < axis.length; ++a) { double t = other.corner[0].dot(axis[a]); // Find the extent of box 2 on axis a double tMin = t; double tMax = t; for (int c = 1; c < corner.length; ++c) { t = other.corner[c].dot(axis[a]); if (t < tMin) { tMin = t; } else if (t > tMax) { tMax = t; } } // We have to subtract off the origin // See if [tMin, tMax] intersects [0, 1] if ((tMin > 1 + origin[a]) || (tMax < origin[a])) { // There was no intersection along this dimension; // the boxes cannot possibly overlap. return false; } } // There was no dimension along which there is no intersection. // Therefore the boxes overlap. return true; } public void moveTo(float centerx, float centery) { float cx,cy; cx = center.x; cy = center.y; deltaVec.x = centerx - cx; deltaVec.y = centery - cy; for (int c = 0; c < 4; ++c) { corner[c].x += deltaVec.x; corner[c].y += deltaVec.y; } boundingRect.left += deltaVec.x; boundingRect.top += deltaVec.y; boundingRect.right += deltaVec.x; boundingRect.bottom += deltaVec.y; this.center.x = centerx; this.center.y = centery; computeAxes(); } // Returns true if the intersection of the boxes is non-empty. public boolean overlaps(OBB2D other) { if(right() < other.left()) { return false; } if(bottom() < other.top()) { return false; } if(left() > other.right()) { return false; } if(top() > other.bottom()) { return false; } if(other.getAngle() == 0.0f && getAngle() == 0.0f) { return true; } return overlaps1Way(other) && other.overlaps1Way(this); } public Vector2D getCenter() { return center; } public float getWidth() { return extents.x * 2; } public float getHeight() { return extents.y * 2; } public void setAngle(float angle) { set(center.x,center.y,getWidth(),getHeight(),angle); } public float getAngle() { return angle; } public void setSize(float w,float h) { set(center.x,center.y,w,h,angle); } public float left() { return boundingRect.left; } public float right() { return boundingRect.right; } public float bottom() { return boundingRect.bottom; } public float top() { return boundingRect.top; } public RectF getBoundingRect() { return boundingRect; } public boolean overlaps(float left, float top, float right, float bottom) { if(right() < left) { return false; } if(bottom() < top) { return false; } if(left() > right) { return false; } if(top() > bottom) { return false; } return true; } public static float distance(float ax, float ay,float bx, float by) { if (ax < bx) return bx - ay; else return ax - by; } public Vector2D project(float ax, float ay) { projVec.x = Float.MAX_VALUE; projVec.y = Float.MIN_VALUE; for (int i = 0; i < corner.length; ++i) { float dot = Vector2D.dot(corner[i].x,corner[i].y,ax,ay); projVec.x = JMath.min(dot, projVec.x); projVec.y = JMath.max(dot, projVec.y); } return projVec; } public Vector2D getCorner(int c) { return corner[c]; } public int getNumCorners() { return corner.length; } public boolean pointInside(float x, float y) { float newy = (float) (Math.sin(angle) * (y - center.y) + Math.cos(angle) * (x - center.x)); float newx = (float) (Math.cos(angle) * (x - center.x) - Math.sin(angle) * (y - center.y)); return (newy > center.y - (getHeight() / 2)) && (newy < center.y + (getHeight() / 2)) && (newx > center.x - (getWidth() / 2)) && (newx < center.x + (getWidth() / 2)); } public boolean pointInside(Vector2D v) { return pointInside(v.x,v.y); } public ArrayList<Vector2D> getCollsionPoints(OBB2D b) { collisionPoints.clear(); for(int i = 0; i < corner.length; ++i) { if(b.pointInside(corner[i])) { collisionPoints.add(corner[i]); } } for(int i = 0; i < b.corner.length; ++i) { if(pointInside(b.corner[i])) { collisionPoints.add(b.corner[i]); } } return collisionPoints; } }; What could be wrong? When I getCollisionPoints for 2 OBBs I know are penetrating, it returns no points. Thanks

    Read the article

  • Point of contact of 2 OBBs?

    - by Milo
    I'm working on the physics for my GTA2-like game so I can learn more about game physics. The collision detection and resolution are working great. I'm now just unsure how to compute the point of contact when I hit a wall. Here is my OBB class: public class OBB2D { private Vector2D projVec = new Vector2D(); private static Vector2D projAVec = new Vector2D(); private static Vector2D projBVec = new Vector2D(); private static Vector2D tempNormal = new Vector2D(); private Vector2D deltaVec = new Vector2D(); // Corners of the box, where 0 is the lower left. private Vector2D corner[] = new Vector2D[4]; private Vector2D center = new Vector2D(); private Vector2D extents = new Vector2D(); private RectF boundingRect = new RectF(); private float angle; //Two edges of the box extended away from corner[0]. private Vector2D axis[] = new Vector2D[2]; private double origin[] = new double[2]; public OBB2D(float centerx, float centery, float w, float h, float angle) { for(int i = 0; i < corner.length; ++i) { corner[i] = new Vector2D(); } for(int i = 0; i < axis.length; ++i) { axis[i] = new Vector2D(); } set(centerx,centery,w,h,angle); } public OBB2D(float left, float top, float width, float height) { for(int i = 0; i < corner.length; ++i) { corner[i] = new Vector2D(); } for(int i = 0; i < axis.length; ++i) { axis[i] = new Vector2D(); } set(left + (width / 2), top + (height / 2),width,height,0.0f); } public void set(float centerx,float centery,float w, float h,float angle) { float vxx = (float)Math.cos(angle); float vxy = (float)Math.sin(angle); float vyx = (float)-Math.sin(angle); float vyy = (float)Math.cos(angle); vxx *= w / 2; vxy *= (w / 2); vyx *= (h / 2); vyy *= (h / 2); corner[0].x = centerx - vxx - vyx; corner[0].y = centery - vxy - vyy; corner[1].x = centerx + vxx - vyx; corner[1].y = centery + vxy - vyy; corner[2].x = centerx + vxx + vyx; corner[2].y = centery + vxy + vyy; corner[3].x = centerx - vxx + vyx; corner[3].y = centery - vxy + vyy; this.center.x = centerx; this.center.y = centery; this.angle = angle; computeAxes(); extents.x = w / 2; extents.y = h / 2; computeBoundingRect(); } //Updates the axes after the corners move. Assumes the //corners actually form a rectangle. private void computeAxes() { axis[0].x = corner[1].x - corner[0].x; axis[0].y = corner[1].y - corner[0].y; axis[1].x = corner[3].x - corner[0].x; axis[1].y = corner[3].y - corner[0].y; // Make the length of each axis 1/edge length so we know any // dot product must be less than 1 to fall within the edge. for (int a = 0; a < axis.length; ++a) { float l = axis[a].length(); float ll = l * l; axis[a].x = axis[a].x / ll; axis[a].y = axis[a].y / ll; origin[a] = corner[0].dot(axis[a]); } } public void computeBoundingRect() { boundingRect.left = JMath.min(JMath.min(corner[0].x, corner[3].x), JMath.min(corner[1].x, corner[2].x)); boundingRect.top = JMath.min(JMath.min(corner[0].y, corner[1].y),JMath.min(corner[2].y, corner[3].y)); boundingRect.right = JMath.max(JMath.max(corner[1].x, corner[2].x), JMath.max(corner[0].x, corner[3].x)); boundingRect.bottom = JMath.max(JMath.max(corner[2].y, corner[3].y),JMath.max(corner[0].y, corner[1].y)); } public void set(RectF rect) { set(rect.centerX(),rect.centerY(),rect.width(),rect.height(),0.0f); } // Returns true if other overlaps one dimension of this. private boolean overlaps1Way(OBB2D other) { for (int a = 0; a < axis.length; ++a) { double t = other.corner[0].dot(axis[a]); // Find the extent of box 2 on axis a double tMin = t; double tMax = t; for (int c = 1; c < corner.length; ++c) { t = other.corner[c].dot(axis[a]); if (t < tMin) { tMin = t; } else if (t > tMax) { tMax = t; } } // We have to subtract off the origin // See if [tMin, tMax] intersects [0, 1] if ((tMin > 1 + origin[a]) || (tMax < origin[a])) { // There was no intersection along this dimension; // the boxes cannot possibly overlap. return false; } } // There was no dimension along which there is no intersection. // Therefore the boxes overlap. return true; } public void moveTo(float centerx, float centery) { float cx,cy; cx = center.x; cy = center.y; deltaVec.x = centerx - cx; deltaVec.y = centery - cy; for (int c = 0; c < 4; ++c) { corner[c].x += deltaVec.x; corner[c].y += deltaVec.y; } boundingRect.left += deltaVec.x; boundingRect.top += deltaVec.y; boundingRect.right += deltaVec.x; boundingRect.bottom += deltaVec.y; this.center.x = centerx; this.center.y = centery; computeAxes(); } // Returns true if the intersection of the boxes is non-empty. public boolean overlaps(OBB2D other) { if(right() < other.left()) { return false; } if(bottom() < other.top()) { return false; } if(left() > other.right()) { return false; } if(top() > other.bottom()) { return false; } if(other.getAngle() == 0.0f && getAngle() == 0.0f) { return true; } return overlaps1Way(other) && other.overlaps1Way(this); } public Vector2D getCenter() { return center; } public float getWidth() { return extents.x * 2; } public float getHeight() { return extents.y * 2; } public void setAngle(float angle) { set(center.x,center.y,getWidth(),getHeight(),angle); } public float getAngle() { return angle; } public void setSize(float w,float h) { set(center.x,center.y,w,h,angle); } public float left() { return boundingRect.left; } public float right() { return boundingRect.right; } public float bottom() { return boundingRect.bottom; } public float top() { return boundingRect.top; } public RectF getBoundingRect() { return boundingRect; } public boolean overlaps(float left, float top, float right, float bottom) { if(right() < left) { return false; } if(bottom() < top) { return false; } if(left() > right) { return false; } if(top() > bottom) { return false; } return true; } public static float distance(float ax, float ay,float bx, float by) { if (ax < bx) return bx - ay; else return ax - by; } public Vector2D project(float ax, float ay) { projVec.x = Float.MAX_VALUE; projVec.y = Float.MIN_VALUE; for (int i = 0; i < corner.length; ++i) { float dot = Vector2D.dot(corner[i].x,corner[i].y,ax,ay); projVec.x = JMath.min(dot, projVec.x); projVec.y = JMath.max(dot, projVec.y); } return projVec; } public Vector2D getCorner(int c) { return corner[c]; } public int getNumCorners() { return corner.length; } public static float collisionResponse(OBB2D a, OBB2D b, Vector2D outNormal) { float depth = Float.MAX_VALUE; for (int i = 0; i < a.getNumCorners() + b.getNumCorners(); ++i) { Vector2D edgeA; Vector2D edgeB; if(i >= a.getNumCorners()) { edgeA = b.getCorner((i + b.getNumCorners() - 1) % b.getNumCorners()); edgeB = b.getCorner(i % b.getNumCorners()); } else { edgeA = a.getCorner((i + a.getNumCorners() - 1) % a.getNumCorners()); edgeB = a.getCorner(i % a.getNumCorners()); } tempNormal.x = edgeB.x -edgeA.x; tempNormal.y = edgeB.y - edgeA.y; tempNormal.normalize(); projAVec.equals(a.project(tempNormal.x,tempNormal.y)); projBVec.equals(b.project(tempNormal.x,tempNormal.y)); float distance = OBB2D.distance(projAVec.x, projAVec.y,projBVec.x,projBVec.y); if (distance > 0.0f) { return 0.0f; } else { float d = Math.abs(distance); if (d < depth) { depth = d; outNormal.equals(tempNormal); } } } float dx,dy; dx = b.getCenter().x - a.getCenter().x; dy = b.getCenter().y - a.getCenter().y; float dot = Vector2D.dot(dx,dy,outNormal.x,outNormal.y); if(dot > 0) { outNormal.x = -outNormal.x; outNormal.y = -outNormal.y; } return depth; } public Vector2D getMoveDeltaVec() { return deltaVec; } }; Thanks!

    Read the article

  • Is it possible to shuffle a 2D matrix while preserving row AND column frequencies?

    - by j_random_hacker
    Suppose I have a 2D array like the following: GACTG AGATA TCCGA Each array element is taken from a small finite set (in my case, DNA nucleotides -- {A, C, G, T}). I would like to randomly shuffle this array somehow while preserving both row and column nucleotide frequencies. Is this possible? Can it be done efficiently? [EDIT]: By this I mean I want to produce a new matrix where each row has the same number of As, Cs, Gs and Ts as the corresponding row of the original matrix, and where each column has the same number of As, Cs, Gs and Ts as the corresponding column of the original matrix. Permuting the rows or columns of the original matrix will not achieve this in general. (E.g. for the example above, the top row has 2 Gs, and 1 each of A, C and T; if this row was swapped with row 2, the top row in the resulting matrix would have 3 As, 1 G and 1 T.) It's simple enough to preserve just column frequencies by shuffling a column at a time, and likewise for rows. But doing this will in general alter the frequencies of the other kind. My thoughts so far: If it's possible to pick 2 rows and 2 columns so that the 4 elements at the corners of this rectangle have the pattern XY YX for some pair of distinct elements X and Y, then replacing these 4 elements with YX XY will maintain both row and column frequencies. In the example at the top, this can be done for (at least) rows 1 and 2 and columns 2 and 5 (whose corners give the 2x2 matrix AG;GA), and for rows 1 and 3 and columns 1 and 4 (whose corners give GT;TG). Clearly this could be repeated a number of times to produce some level of randomisation. Generalising a bit, any "subrectangle" induced by a subset of rows and a subset of columns, in which the frequencies of all rows are the same and the frequencies of all columns are the same, can have both its rows and columns permuted to produce a valid complete rectangle. (Of these, only those subrectangles in which at least 1 element is changed are actually interesting.) Big questions: Are all valid complete matrices reachable by a series of such "subrectangle rearrangements"? I suspect the answer is yes. Are all valid subrectangle rearrangements decomposable into a series of 2x2 swaps? I suspect the answer is no, but I hope it's yes, since that would seem to make it easier to come up with an efficient algorithm. Can some or all of the valid rearrangements be computed efficiently? This question addresses a special case in which the set of possible elements is {0, 1}. The solutions people have come up with there are similar to what I have come up with myself, and are probably usable, but not ideal as they require an arbitrary amount of backtracking to work correctly. Also I'm concerned that only 2x2 swaps are considered. Finally, I would ideally like a solution that can be proven to select a matrix uniformly at random from the set of all matrices having identical row frequencies and column frequencies to the original. I know, I'm asking for a lot :)

    Read the article

  • CSS optimization - extra classes in dom or preprocessor-repetitive styling in css file?

    - by anna.mi
    I'm starting on a fairly large project and I'm considering the option of using LESS for pre-processing my css. the useful thing about LESS is that you can define a mixin that contains for example: .border-radius(@radius) { -webkit-border-radius: @radius; -moz-border-radius: @radius; -o-border-radius: @radius; -ms-border-radius: @radius; border-radius: @radius; } and then use it in a class declaration as .rounded-div { .border-radius(10px); } to get the outputted css as: .rounded-div { -webkit-border-radius: 10px; -moz-border-radius: 10px; -o-border-radius: 10px; -ms-border-radius: 10px; border-radius: 10px; } this is extremely useful in the case of browser prefixes. However this same concept could be used to encapsulate commonly-used css, for example: .column-container { overflow: hidden; display: block; width: 100%; } .column(@width) { float: left; width: @width; } and then use this mixin whenever i need columns in my design: .my-column-outer { .column-container(); background: red; } .my-column-inner { .column(50%); font-color: yellow; } (of course, using the preprocessor we could easily expand this to be much more useful, eg. pass the number of columns and the container width as variables and have LESS determine the width of each column depending on the number of columns and container width!) the problem with this is that when compliled, my final css file would have 100 such declarations, copy&pasted, making the file huge and bloated and repetitive. The alternative to this would be to use a grid system which has predefined classes for each column-layout option, eg .c-50 ( with a "float: left; width:50%;" definition ), .c-33, .c-25 to accomodate for a 2-column, 3-column and 4-column layout and then use these classes to my dom. i really mislike the idea of the extra classes, from experience it results to bloated dom (creating extra divs just to attach the grid classes to). Also the most basic tutorial for html/css would tell you that the dom should be separated from the styling - grid classes are styling related! to me, its the same as attaching a "border-radius-10" class to the .rounded-div example above! on the other hand, the large css file that would result from the repetitive code is also a disadvantage so i guess my question is, which one would you recommend? and which do you use? and, which solution is best for optimization? apart from the larger file size, has there even been any research on whether browser renders multiple classes faster than a large css file, or the other way round? tnx! i'd love to hear your opinion!

    Read the article

  • UIImage Shadow Trouble

    - by Brandon Schlenker
    I'm trying to add a small shadow to an image, much like the icon shadows in the App Store. Right now I'm using the following code to round the corners of my images. Does anyone know how I can adapt it to add a small shadow? - (UIImage *)roundCornersOfImage:(UIImage *)source height:(int)height width:(int)width { int w = width; int h = height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef imageContext = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextBeginPath(imageContext); CGRect rect = CGRectMake(0, 0, w, h); addRoundedRectToPath(imageContext, rect, 10, 10); CGContextClosePath(imageContext); CGContextClip(imageContext); CGContextDrawImage(imageContext, CGRectMake(0, 0, w, h), source.CGImage); CGImageRef imageMasked = CGBitmapContextCreateImage(imageContext); CGContextRelease(imageContext); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } "addRoundedRectToPath" refers to another method that obviously rounds the corners.

    Read the article

  • IE6 - too much spacing appearing above h3, how do I get rid of it?

    - by codemonkey613
    Example: http://bit.ly/dfjvmT If you take a look at that URL, you will see an <h3> labeled "Send Us Your Resume". Problem is -- in IE6, it has too much space at the top. It's supposed to be margin-top of 16px, but in IE6, it appears more like 24-30px. I have a reset.css file which has zeroed all margins and paddings, so it's not that. Just checked, both CSS and XHTML are valid. And I notice this spacing error only appears when I put a before this <h3>. Currently, I have <div class="top"></div> which appears before this <h3>. That part takes care of rounded corners for the container. When I remove that <div>, the spacing finally matches in both IE6 and Firefox. Of course, I need to use that <div> for rounded corners. So I'm wondering, what exactly is causing this problem, and is there a way to fix it? Thanks

    Read the article

  • Is it possible to have a SeekBar's thumb image extend outside the bar?

    - by Poko
    I have set negative paddings on my custom seekbar so that the round thumb image can go outside the bar, but the thumb isn't rendered out there, is there anyway to force the thumb to be drawn outside those bounds? Sorry guys, I'm new to Android development, and have been tasked with fixing an existing application. The problem is that we have a custom rounded looking track bar, which consists of two rounded 'end cap' images and a 1 px background that is tiled to create the seekbar. As far as I can tell there was never one image that could be set as the background of a normal SeekBar, which is why a custom one was created. The thumb is a circle and needs to 'fit' into the end caps - the three pieces of the bar are in a relative layout. Right now I'm kind of unclear as to how the 1 px background png gets stretched as the seekbar bg, otherwise I would try to tack on the two endcaps onto that drawable some how ... ? Please let me know if this was unclear and I'll try to post any followup info. Thanks in advance for any advice!! Oh, I'm using Android 2.1 if that's relevant to anyone's interests :)

    Read the article

  • Forwarding first responder to UIScrollView unsuccessful

    - by Winston
    Hello, I am trying to create an image cropping bpx whereby the underlying image can be zoomed an scrolled while the cropping "maskview" layer stays the same and the corners can be dragged in any direction. To achieve this, the ImageView is added to a UIScrollView, and this is added to the SelectionViewController.view . I then add the cropping "maskview" layer to the SelectionViewController.view. I did this instead of adding to the scrollview so that the cropping maskview won't be expanded when the underlying image expands. @interface SelectionViewController : UIViewController <UIScrollViewDelegate> { UIImageView *photoview; // Added to self.scrollview MaskedView *maskedview; // Added to self.view UIScrollView *scrollview; // Added to self.view } The maskview has first responder status and responds accordingly. However, the only event I am interested in the maskview is if any of the corners are dragged (this works fine). The problem I want to try to solve is two-fold: If it is a pinch or zoom gesture, I am trying to forward the responder to the UIScrollview using: [self.nextResponder touchesMoved:touches withEvent:event]; The scrollview does not seem to respond. I have confirmed that the self.nextResponder after the maskedview is the SelectionViewController's view itself. From there, it doesn't seem like the UIScrollview responds. It does respond fine if I remove the cropping maskedview. If I zoom in on the underlying image and the cropping maskview rectangle is still the same, I want to now crop the actual zoomed image. Let's say for the upper left hand corner of the crop box, how can I find what the coordinates translates to in the underlying UIImageView now that the image has been zoomed? Any insight into either of these questions would be appreciated. Thank you, Winston

    Read the article

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