Search Results

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

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

  • Drawing Quadratic Bezier circles with a given radius: how to determine control points

    - by Casey
    Just to clarify; the code below works, but I don't understand where the formula for the variable "controlRadius" comes from. I wrote this function by dissecting an example I found elsewhere, but I can't find any explanation and the original code comments were not able to be translated. Thanks in advance //returns an array of quadratic Bezier segments public static function generateCircularQuadraticBezierSegments(radius:Number, numControlPoints:uint, centerX:Number, centerY:Number):Array { var segments:Array = []; var arcLength:Number = 2 * Math.PI / numControlPoints; var controlRadius:Number; var segment:QuadraticBezierSegment; for (var i:int = 0; i < numControlPoints; i++) { var startX:Number = centerX + radius * Math.cos(arcLength * i); var startY:Number = centerY + radius * Math.sin(arcLength * i); //control radius formula //where does it come from, why does it work? controlRadius = radius / Math.cos(arcLength * .5); //the control point is plotted halfway between the arcLength and uses the control radius var controlX:Number = centerX + controlRadius * Math.cos(arcLength * (i + 1) - arcLength * .5); var controlY:Number = centerY + controlRadius * Math.sin(arcLength * (i + 1) - arcLength * .5); var endX:Number = centerX + radius * Math.cos(arcLength * (i + 1)); var endY:Number = centerY + radius * Math.sin(arcLength * (i + 1)); segment = new QuadraticBezierSegment(new Point(startX, startY), new Point(controlX, controlY), new Point(endX, endY)); segments.push(segment); } return segments; }

    Read the article

  • Google pourrait lancer son réseau social Google Circles en Mai, mais la firme dément la rumeur et réfute l'existence d'un tel service

    Google pourrait lancer son réseau social Google Circles en Mai, mais la firme dément la rumeur et réfute l'existence d'un tel service Le Web est en effervescence depuis ce matin, depuis qu'un site a lancé une rumeur : Google lancerait ce jour un nouveau réseau social : Google Circles. Ce dernier consisterait en un service d'échange de photos et de vidéos, mais aussi de partage de "statuts". Les contenus ainsi partagés ne le seraient qu'avec les "contacts les plus appropriés de votre cercle" d'amis virtuels, soit du tri sélectif pour chaque donnée échangée. Le produit serait développé sous la direction de Chris Messina (créateur de succès numériques comme BarCamp ou Hashtags), avec entre autres dan...

    Read the article

  • What are those white circles on the desktop in Gnome 3?

    - by monk
    I have Fedora 20 with GNOME 3.10.2. On the desktop background (i.e. where the wallpaper is), there are five small white circles centered at the very bottom of the screen. The first is filled, the others are not. I can click those circles, thereby changing which one is filled, like a radio button. I cannot for the life of me figure out what those circles are supposed to do, and it's starting to drive me crazy. Clicking and thus changing which circle is filled does nothing I can perceive, and there seems to be no configuration option anywhere that has anything to do with them. What are those things? Is there any way to get rid of them? Edit: I made a screenshot of my desktop with no programs running. You can see the dot/circle thingies at the bottom. Link: http://www.imageupload.co.uk/images/2014/08/18/Screenshot_from_2014-08-18_235427.png

    Read the article

  • Circle drawing with SVG's arc path

    - by ????
    The following SVG path can draw 99.99% of a circle: (try it on http://jsfiddle.net/DFhUF/46/ and see if you see 4 arcs or only 2, but note that if it is IE, it is rendered in VML, not SVG, but have the similar issue) M 100 100 a 50 50 0 1 0 0.00001 0 But when it is 99.99999999% of a circle, then nothing will show at all? M 100 800 a 50 50 0 1 0 0.00000001 0 And that's the same with 100% of a circle (it is still an arc, isn't it, just a very complete arc) M 100 800 a 50 50 0 1 0 0 0 How can that be fixed? The reason is I use a function to draw a percentage of an arc, and if I need to "special case" a 99.9999% or 100% arc to use the circle function, that'd be kind of silly. Again, a test case on jsfiddle using RaphaelJS is at http://jsfiddle.net/DFhUF/46/ (and if it is VML on IE 8, even the second circle won't show... you have to change it to 0.01) Update: This is because I am rendering an arc for a score in our system, so 3.3 points get 1/3 of a circle. 0.5 gets half a circle, and 9.9 points get 99% of a circle. But what if there are scores that are 9.99 in our system? Do I have to check whether it is close to 99.999% of a circle, and use an arc function or a circle function accordingly? Then what about a score of 9.9987? Which one to use? It is ridiculous to need to know what kind of scores will map to a "too complete circle" and switch to a circle function, and when it is "a certain 99.9%" of a circle or a 9.9987 score, then use the arc function.

    Read the article

  • Centre of a circle that intersects two points

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

    Read the article

  • What would be a good opensource software for graphing circles, circular regions, and regions bounded by curves and/or arcs?

    - by Michael Dykes
    Hullo all. I have just started s job with Chegg, and my 1st assignment has me writign solutions for Stewart's Essential Calculus. I am dealing with the chapter on multiple integration, and need a good open-source software that I can easily use to draw regions (domains) that would require multiple integrals: i.e. circular regions, portions of circles, regions bounded by curves and/or arcs, and at some point 3D pictures. In most of these cases, I am not working with an exact equation or perhaps need to draw the region bounded by r (radius) between 1 and 2, and the angle theta bounded between pi/4 and 3 pi/4. I am not too terribly familiar with programs like Corel Draw, but the documents I have from this company suggest Corel Draw. So I think I am looking for an open-source free program like Corel Draw or something similar. Any additional suggestions would also be appreciated. I know I can do most, if not all of this using TikZ, but the learning curve is a bit steep, and at the moment I an on a time constraint. Thanks.

    Read the article

  • Raphael - what is the native delay function to draw circles?

    - by 3gwebtrain
    I am using Raphael, to draw 3 circles. how to i make the circles draw each one by one with some time gap? I know there is a option with settimeout, but apart from is there any native function to make delay to draw the circles? my simple code: <div id="paper"></div> var paper = Raphael('paper',500,500); var c1 = paper.circle(50,50,25); var c2 = paper.circle(100,50,25); var c3 = paper.circle(150,50,25); jsfiddle here

    Read the article

  • Instead of the specified Texture, black circles on a green background are getting rendered. Why?

    - by vinzBad
    I'm trying to render a Texture via OpenGL. But instead of the texture black circles on a green background are rendered. (They scale, depending what the rotation of the texture is) Example: The texture I'm trying to render is the following: This is the code I use to render the texture, it's located in my Sprite-class. public void Render() { Matrix4 matrix = Matrix4.CreateTranslation(-OriginX, -OriginY, 0) * Matrix4.CreateRotationZ(Rotation) * Matrix4.CreateTranslation(X, Y, 0); Vector2[] corners = { new Vector2(0,0), //top left new Vector2(Width ,0),//top right new Vector2(Width,Height),//bottom rigth new Vector2(0,Height)//bottom left }; //copy the corners to the uv coordinates Vector2[] uv = corners.ToArray<Vector2>(); //transform the coordinates for (int i = 0; i < 4; i++) corners[i] = new Vector2(Vector3.Transform(new Vector3(corners[i]), matrix)); //GL.Color3(TintColor); GL.BindTexture(TextureTarget.Texture2D, _ID); GL.Begin(BeginMode.Quads); { for (int i = 0; i < 4; i++) { GL.TexCoord2(uv[i]); GL.Vertex3(corners[i].X, corners[i].Y, _layerDepth); } } GL.End(); if (EnableDebugDraw) { GL.Color3(Color.Violet); GL.PointSize(3); GL.Begin(BeginMode.Points); { for (int i = 0; i < 4; i++) GL.Vertex2(corners[i]); } GL.End(); GL.Color3(Color.Green); GL.Begin(BeginMode.Points); GL.Vertex2(X, Y); GL.End(); } } This is how I setup OpenGL. public static void SetupGL() { GL.Enable(EnableCap.AlphaTest); GL.AlphaFunc(AlphaFunction.Greater, 0.1f); GL.Enable(EnableCap.Texture2D); GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); } With this function I load the texture: public static uint LoadTexture(string path) { uint id; GL.GenTextures(1, out id); GL.BindTexture(TextureTarget.Texture2D, id); Bitmap bitmap = new Bitmap(path); BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); bitmap.UnlockBits(data); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); return id; } And here I call Sprite.Render() protected override void OnRenderFrame(FrameEventArgs e) { GL.ClearColor(Color.MidnightBlue); GL.Clear(ClearBufferMask.ColorBufferBit); _sprite.Render(); SwapBuffers(); base.OnRenderFrame(e); } As I stole this code from the Textures-Example from OpenTK, I don't understand why this doesn't work.

    Read the article

  • How find all overlapping circles from radius of central circle?

    - by roza
    How to do an intersection or overlap query in mongo shell - what circles overlap my search region? Within relate only to the center position but doesn't include radius of the other circles in searched scope. Mongo: # My bad conception: var search = [[30, 30], 10] db.places.find({circle : {"$within" : {"$center" : [search]}}}) Now I can obtain only this circles within central point lies in searched area of circle: Ruby: # field :circle, type: Circle # eg. [ [ 30, 30 ], 10 ] field :radius, type: Integer field :location, :type => Array, :spatial => true spatial_index :location Places.within_circle(location: [ [ 30, 30 ], 10 ]) # {"$query"=>{"location"=>{"$within"=>{"$center"=>[[30, 30], 10]}}} I created example data with additional location (special index) and radius instead circle because circle isn't supported by mongodb geo index: { "_id" : 1, "name" : "a", "circle" : [ [ 5, 5 ], 40 ], "latlng" : [ 5, 5 ], "radius" : 40 } { "_id" : 2, "name" : "b", "circle" : [ [ 10, 10 ], 5 ], "latlng" : [ 10, 10 ], "radius" : 5 } { "_id" : 3, "name" : "c", "circle" : [ [ 20, 20 ], 5 ], "latlng" : [ 20, 20 ], "radius" : 5 } { "_id" : 4, "name" : "d", "circle" : [ [ 30, 30 ], 50 ], "latlng" : [ 30, 30 ], "radius" : 50} { "_id" : 5, "name" : "e", "circle" : [ [ 80, 80 ], 30 ], "latlng" : [ 80, 80 ], "radius" : 30} { "_id" : 6, "name" : "f", "circle" : [ [ 80, 80 ], 20 ], "latlng" : [ 80, 80 ], "radius" : 20} Desired query result: { "_id" : 1, "name" : "a", "circle" : [ [ 5, 5 ], 40 ], "latlng" : [ 5, 5 ], "radius" : 40 } { "_id" : 3, "name" : "c", "circle" : [ [ 20, 20 ], 5 ], "latlng" : [ 20, 20 ], "radius" : 5 } { "_id" : 4, "name" : "d", "circle" : [ [ 30, 30 ], 50 ], "latlng" : [ 30, 30 ], "radius" : 50} { "_id" : 5, "name" : "e", "circle" : [ [ 80, 80 ], 30 ], "latlng" : [ 80, 80 ], "radius" : 30} Solution below assumes that I get all rows and then filter on the ruby side my radius but it returns only: { "_id" : 4, "name" : "d", "circle" : [ [ 30, 30 ], 50 ], "latlng" : [ 30, 30 ], "radius" : 50}

    Read the article

  • How much more complex is it to draw simple curves, lines and circles in OpenGL ES rather than in Qua

    - by mystify
    Is OpenGL ES really so much faster? Why? And is it really so horrible complicated to draw such simple things in OpenGL ES compared to drawing these in Quartz 2D? For example, I have a UIView subclass with -drawRect: implemented, where I draw some lines, curves and circles. Just simple paths, with some shadow. What would I do in OpenGL ES? Isn't there this nice EAGLView layer thing? One thing that comes to mind is how do touch events go into OpenGL ES? Maybe that's the complex thing about it? Are there tutorials on basic drawing operations in OpenGL ES?

    Read the article

  • How to find patterns (lines, circles,...) from a list of points?

    - by Burkhard
    I have a list of points. Each point being an x and y coordinate (both of which are integers). Now I'm trying to find known patterns, such as lines, arcs or circles, knowing that the points are not perfectly on the pattern. What's the best way to do it? I don't have many clues to get started. Edit: the points are ordered. The user is drawing something and the program should detect the best patterns. For instance, if a triangle is drawn, it should detect three lines.

    Read the article

  • After drawing circles on C# form how can i know on what circle i clicked?

    - by SorinA.
    I have to represent graphically an oriented graph like in the image below. i have a C# form, when i click with the mouse on it i have to draw a node. If i click somewhere on the form where is not already a node drawn it means i cliked with the intetion of drawing a node, if it is a node there i must select it and memorize it. On the next mouse click if i touch a place where there is not already a node drawn it means like before that i want to draw a new node, if it is a node where i clicked i need to draw the line from the first memorized node to the selected one and add road cost details. i know how to draw the circles that represent the nodes of the graph when i click on the form. i'm using the following code: namespace RepGraficaAUnuiGraf { public partial class Form1 : Form { Graphics graphDrawingArea; Bitmap bmpDrawingArea; Graphics graph; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { bmpDrawingArea = new Bitmap(Width, Height); graphDrawingArea = Graphics.FromImage(bmpDrawingArea); graph = Graphics.FromHwnd(this.Handle); } private void Form1_Click(object sender, EventArgs e) { DrawCentralCircle(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y, 15); graph.DrawImage(bmpDrawingArea, 0, 0); } void DrawCentralCircle(int CenterX, int CenterY, int Radius) { int start = CenterX - Radius; int end = CenterY - Radius; int diam = Radius * 2; bmpDrawingArea = new Bitmap(Width, Height); graphDrawingArea = Graphics.FromImage(bmpDrawingArea); graphDrawingArea.DrawEllipse(new Pen(Color.Blue), start, end, diam, diam); graphDrawingArea.DrawString("1", new Font("Tahoma", 13), Brushes.Black, new PointF(CenterX - 8, CenterY - 10)); } } } My question is how can i find out if at the coordinates (x,y) on my form i drew a node and which one is it? I thought of representing the nodes as buttons, having a tag or something similar as the node number(which in drawing should be 1 for Santa Barbara, 2 for Barstow etc.)

    Read the article

  • text in textbox shows up as circles instead of regular characters?

    - by BlueMonster
    When i type in either of the textboxes i get little circles appearing instead of text. Why is this happening and how do i stop it? Code is as follows: HTML: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="Foods.MainPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link id="Link1" rel="stylesheet" type="text/css" href="Styles/mainStyle.css"/> </head> <body> <form id="form1" runat="server"> <div class = "userIDTboxDiv"> <div class = "userIDTboxText"> &nbsp;&nbsp;&nbsp; Enter User ID: </div> <asp:TextBox id="userIDBox" TextMode="password" runat="server" Height="52px" Width="200px" /> </div> <div class = "passwordTboxDiv"> <div class = "passwordTboxText"> &nbsp;&nbsp;&nbsp; Enter User Password: </div> <asp:TextBox id="TextBox1" TextMode="password" runat="server" Height="52px" Width="200px" /> </div> </form> </body> CSS: body { text-decoration:none; background: white; } input { margin-left: 0px; margin-top: 7px; } .userIDTboxDiv { padding-top: 20%; padding-left: 45%; width: 15%; height: 30%; } .userIDTboxText { padding-left: 17%; height: auto; width:203px; } .passwordTboxDiv { padding-top: 2%; padding-left: 45%; width: 15%; height: 111px; } .passwordTboxText { padding-left: 10%; height: auto; width:203px; }

    Read the article

  • Circle physics and collision using vectors

    - by Joe Hearty
    This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want them to have collision detection and push in the opposite direction using vectors but I don't know how to apply that to my scenario could someone help? public void drawballs(Graphics g){ g.setColor (Color.white); //displays circles for(int i = 0; i<xlocationofcircles.length-1; i++){ g.fillOval( (int) xlocationofcircles[i], (int) (ylocationofcircles[i]) ,16 ,16 ); ylocationofcircles[i]+=.2; //gravity if(ylocationofcircles[i] > 550) //stops gravity at bottom of screen ylocationofcircles[i]-=.2; //Check distance between circles(i think..) float distance =(xlocationofcircles[i+1]-xlocationofcircles[i]) + (ylocationofcircles[i+1]-xlocationofcircles[i]); if( Math.sqrt(distance) <16) ...

    Read the article

  • d3: Coloring Multiple Lines from Nested Data

    - by diet_coke
    I'm currently assembling some line graphs with circles at the datapoints from arrays of JSON objects formatted like so: var data = [{ "name": "metric1", "datapoints": [ [10.0, 1333519140], [48.0, 1333519200] ] }, { "name": "metric2", "datapoints": [ [48.0, 1333519200], [12.0, 1333519260] ] }] I want to have a color for each metric, so I'm trying to color them based on the index of the object within the array data. The code I have currently for just placing the circles looks like: // We bind an svg group to each metric. var metric_groups = this.vis.selectAll("g.metric_group") .data(data).enter() .append("g") .attr("class", "metric_group"); // Then bind a circle for each datapoint. var circles = metric_groups.selectAll("circle") .data(function(d) { return d.datapoints; }); circles.enter().append("circle") .attr("r", 3.5); Now if I change that last bit to something like: circles.enter().append("circle") .attr("r", 3.5); .style("fill", function(d,i) { return i%2 ? "red" : "blue"; } I get alternating red and blue circles, as could be expected. Taking some advice from Nested Selections : 'Nesting and Index', I tried: circles.enter().append("circle") .attr("r", 3.5); .style("fill", function(d,i,j) { return j%2 ? "red" : "blue"; } Which doesn't work (j is undefined), presumably because we are in the named property datapoints, rather than an array element. How might I go about doing the coloring that I want without changing my data structure? Thanks!

    Read the article

  • WPF, how can I optimize lines and circles drawing ?

    - by Aurélien Ribon
    Hello ! I am developping an application where I need to draw a graph on the screen. For this purpose, I use a Canvas and I put Controls on it. An example of such a draw as shown in the app can be found here : http://free0.hiboox.com/images/1610/d82e0b7cc3521071ede601d3542c7bc5.png It works fine for simple graphs, but I also want to be able to draw very large graphs (hundreds of nodes). And when I try to draw a very large graph, it takes a LOT of time to render. My problem is that the code is not optimized at all, I just wanted it to work. Until now, I have a Canvas on the one hand, and multiple Controls on the other hands. Actually, circles and lines are listed in collections, and for each item of these collections, I use a ControlTemplate, defining a red circle, a black circle, a line, etc. Here is an example, the definition of a graph circle : <!-- STYLE : DISPLAY DATA NODE --> <Style TargetType="{x:Type flow.elements:DisplayNode}"> <Setter Property="Canvas.Left" Value="{Binding X, RelativeSource={RelativeSource Self}}" /> <Setter Property="Canvas.Top" Value="{Binding Y, RelativeSource={RelativeSource Self}}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type flow.elements:DisplayNode}"> <!--TEMPLATE--> <Grid x:Name="grid" Margin="-30,-30,0,0"> <Ellipse x:Name="selectionEllipse" StrokeThickness="0" Width="60" Height="60" Opacity="0" IsHitTestVisible="False"> <Ellipse.Fill> <RadialGradientBrush> <GradientStop Color="Black" Offset="0.398" /> <GradientStop Offset="1" /> </RadialGradientBrush> </Ellipse.Fill> </Ellipse> <Ellipse Stroke="Black" Width="30" Height="30" x:Name="ellipse"> <Ellipse.Fill> <LinearGradientBrush EndPoint="0,1"> <GradientStop Offset="0" Color="White" /> <GradientStop Offset="1.5" Color="LightGray" /> </LinearGradientBrush> </Ellipse.Fill> </Ellipse> <TextBlock x:Name="tblock" Text="{Binding NodeName, RelativeSource={RelativeSource Mode=TemplatedParent}}" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="10.667" /> </Grid> <!--TRIGGERS--> <ControlTemplate.Triggers> <!--DATAINPUT--> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="SkinMode" Value="NODETYPE" /> <Condition Property="NodeType" Value="DATAINPUT" /> </MultiTrigger.Conditions> <Setter TargetName="tblock" Property="Foreground" Value="White" /> <Setter TargetName="ellipse" Property="Fill"> <Setter.Value> <LinearGradientBrush EndPoint="0,1"> <GradientStop Offset="-0.5" Color="White" /> <GradientStop Offset="1" Color="Black" /> </LinearGradientBrush> </Setter.Value> </Setter> </MultiTrigger> <!--DATAOUTPUT--> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="SkinMode" Value="NODETYPE" /> <Condition Property="NodeType" Value="DATAOUTPUT" /> </MultiTrigger.Conditions> <Setter TargetName="tblock" Property="Foreground" Value="White" /> <Setter TargetName="ellipse" Property="Fill"> <Setter.Value> <LinearGradientBrush EndPoint="0,1"> <GradientStop Offset="-0.5" Color="White" /> <GradientStop Offset="1" Color="Black" /> </LinearGradientBrush> </Setter.Value> </Setter> </MultiTrigger> ....... THERE IS A TOTAL OF 7 MULTITRIGGERS ....... </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> Also, the lines are drawn using the Line Control. <!-- STYLE : DISPLAY LINK --> <Style TargetType="{x:Type flow.elements:DisplayLink}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type flow.elements:DisplayLink}"> <!--TEMPLATE--> <Line X1="{Binding X1, RelativeSource={RelativeSource TemplatedParent}}" X2="{Binding X2, RelativeSource={RelativeSource TemplatedParent}}" Y1="{Binding Y1, RelativeSource={RelativeSource TemplatedParent}}" Y2="{Binding Y2, RelativeSource={RelativeSource TemplatedParent}}" Stroke="Gray" StrokeThickness="2" x:Name="line" /> <!--TRIGGERS--> <ControlTemplate.Triggers> <!--BRANCH : ASSERTION--> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="SkinMode" Value="BRANCHTYPE" /> <Condition Property="BranchType" Value="ASSERTION" /> </MultiTrigger.Conditions> <Setter TargetName="line" Property="Stroke" Value="#E0E0E0" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> So, I need your advices. How can I drastically improve the rendering performances ? Should I define each MultiTrigger circle rendering possibility in its own ControlTemplate instead ? Is there a better line drawing technique ? Should I open a DrawingContext and draw everything in one control, instead of having hundreds of controls ?

    Read the article

  • Polymorphic :has_many, :through as module in Rails 3.1 plugin

    - by JohnMetta
    I've search everywhere for a pointer to this, but can't find one. Basically, I want to do what everyone else wants to do when they create a polymorphic relationship in a :has_many, :through way… but I want to do it in a module. I keep getting stuck and think I must be overlooking something simple. To wit: module ActsPermissive module PermissiveUser def self.included(base) base.extend ClassMethods end module ClassMethods def acts_permissive has_many :ownables has_many :owned_circles, :through => :ownables end end end class PermissiveCircle < ActiveRecord::Base belongs_to :ownable, :polymorphic => true end end With a migration that looks like this: create_table :permissive_circles do |t| t.string :ownable_type t.integer :ownable_id t.timestamps end The idea, of course, is that whatever loads acts_permissive will be able to have a list of circles that it owns. For simple tests, I have it "should have a list of circles" do user = Factory :user user.owned_circles.should be_an_instance_of Array end which fails with: Failure/Error: @user.circles.should be_an_instance_of Array NameError: uninitialized constant User::Ownable I've tried: using :class_name => 'ActsPermissive::PermissiveCircle' on the has_many :ownables line, which fails with: Failure/Error: @user.circles.should be_an_instance_of Array ActiveRecord::HasManyThroughSourceAssociationNotFoundError: Could not find the source association(s) :owned_circle or :owned_circles in model ActsPermissive::PermissiveCircle. Try 'has_many :owned_circles, :through => :ownables, :source => <name>'. Is it one of :ownable? while following the suggestion and setting :source => :ownable fails with Failure/Error: @user.circles.should be_an_instance_of Array ActiveRecord::HasManyThroughAssociationPolymorphicSourceError: Cannot have a has_many :through association 'User#owned_circles' on the polymorphic object 'Ownable#ownable' Which seems to suggest that doing things with a non-polymorphic-through is necessary. So I added a circle_owner class similar to the setup here: module ActsPermissive class CircleOwner < ActiveRecord::Base belongs_to :permissive_circle belongs_to :ownable, :polymorphic => true end module PermissiveUser def self.included(base) base.extend ClassMethods end module ClassMethods def acts_permissive has_many :circle_owners, :as => :ownable has_many :circles, :through => :circle_owners, :source => :ownable, :class_name => 'ActsPermissive::PermissiveCircle' end end class PermissiveCircle < ActiveRecord::Base has_many :circle_owners end end With a migration: create_table :permissive_circles do |t| t.string :name t.string :guid t.timestamps end create_table :circle_owner do |t| t.string :ownable_type t.string :ownable_id t.integer :permissive_circle_id end which still fails with: Failure/Error: @user.circles.should be_an_instance_of Array NameError: uninitialized constant User::CircleOwner Which brings us back to the beginning. How can I do what seems to be a rather common polymorphic :has_many, :through on a module? Alternatively, is there a good way to allow an object to be collected by arbitrary objects in a similar way that will work with a module?

    Read the article

  • Looking for software to create Step-By-Step Screenshot guides

    - by Chris
    I like to annotate a series of existing pictures like that one shown below. Each shows GUI elements and i want to add some circles, arrows and numbers to create a step by step guide. Is there a software that ease the job by providing a toolset like pre-defined circles, arrows etc.? Right now i draw the circles myself ... Thanks, Update: i dont want to create videos.

    Read the article

  • Turning a problem into a data

    - by Fogmeister
    OK, I have an app that I'm creating but I'm just really not sure about how to approach the problem. The idea is fairly simple. I'm just not sure how to wrap it in a data model (or even if I should). TBH I feel like I'm making it more complicated than it needs to be. How it works. The app will have circles along the top in a row that need to be connected to circles along the bottom in a row. 10 circles at the top. 10 at the bottom. One connection per pair of dots. Anyway, I can get the dots to connect I'm just not sure how to wrap it in a data model so that I can analyse what has been connected and see if it is right or not. The circles will be questions and answers. I can make an array of question objects with a question and answer properties. I can then display these as the dot pairs. I'm just not sure how to record which questions have been connected to which answers. It is valid for a user to connect a wrong answer as they all get checked at the end. I was thinking of using SpriteKit but this isn't a restriction. I could use UIKit or something else. TBH, this question is fairly language free as I'm just after a way of modelling it.

    Read the article

  • wxpython: adding panel to wx.Frame disables/conflicts with wx.Frame's OnPaint?!

    - by sdaau
    Hi all, I just encountered this strange situation: I found an example, where wx.Frame's OnPaint is overridden, and a circle is drawn. Funnily, as soon as I add even a single panel to the frame, the circle is not drawn anymore - in fact, OnPaint is not called at all anymore ! Can anyone explain me if this is the expected behavior, and how to correctly handle a wx.Frame's OnPaint, if the wx.Frame has child panels ? Small code example is below.. Thanks in advance for any answers, Cheers! The code: #!/usr/bin/env python # http://www.linuxquestions.org/questions/programming-9/wxwidgets-wxpython-drawing-problems-with-onpaint-event-703946/ import wx class MainWindow(wx.Frame): def __init__(self, parent, title, size=wx.DefaultSize): wx.Frame.__init__(self, parent, wx.ID_ANY, title, wx.DefaultPosition, size) self.circles = list() self.displaceX = 30 self.displaceY = 30 circlePos = (self.displaceX, self.displaceY) self.circles.append(circlePos) ## uncommenting either only first, or both of ## the commands below, causes OnPaint *not* to be called anymore! #~ self.panel = wx.Panel(self, wx.ID_ANY) #~ self.mpanelA = wx.Panel(self.panel, -1, size=(200,50)) self.Bind(wx.EVT_PAINT, self.OnPaint) def OnPaint(self, e): print "OnPaint called" dc = wx.PaintDC(self) dc.SetPen(wx.Pen(wx.BLUE)) dc.SetBrush(wx.Brush(wx.BLUE)) # Go through the list of circles to draw all of them for circle in self.circles: dc.DrawCircle(circle[0], circle[1], 10) def main(): app = wx.App() win = MainWindow(None, "Draw delayed circles", size=(620,460)) win.Show() app.MainLoop() if __name__ == "__main__": main()

    Read the article

  • Simple graphics import and manipulation

    - by gnuboi
    What do I need to do something like this? User builds a diagram and tags certain boxes and circles with text. User imports diagram into my program. My program processes the tagged boxes and circles and fills them with different colors. My program exports color-filled diagram. So the questions are... What graphics format supports tag-able boxes and circles? What existing application should I recommend users to use to produce diagrams in the above format? Would this graphics format be very easily readable in code to do things like reading tags and coloring in the associated boxes and circles? Free / open source libraries and apps are desired as this would be for academic use. Thank you!

    Read the article

  • Modular spaceship control

    - by SSS
    I am developing a physics based game with spaceships. A spaceship is constructed from circles connected by joints. Some of the circles have engines attached. Engines can rotate around the center of circle and create thrust. I want to be able to move the ship in a direction or rotate around a point by setting the rotation and thrust for each of the ship's engines. How can I find the rotation and thrust needed for each engine to achieve this?

    Read the article

  • How does this circle collision detection math work?

    - by Griffin
    I'm going through the wildbunny blog to learn about collision detection. I'm confused about how the vectors he's talking about come into play. Here's the part that confuses me: 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. I understand that p is the distance by which the circles penetrate, but I don't get what exactly N and P are. 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||). What's 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

  • Overlay SVG diagrams on google maps

    - by ThibThib
    Hello I would like to add an overlay image on a google map. This image is a SVG file I have generated (python with svgfig). I am using the following code if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(48.8, 2.4), 12);     // ground overlay     var boundaries = new GLatLngBounds(new GLatLng(48.283188032632829, 1.9675270369830129), new GLatLng(49.187215000000002, 2.7771877478303999));     var oldmap = new GGroundOverlay("test.svg", boundaries); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.addOverlay(oldmap); } Surprisingly, it works with Safari 4, but it doesn't with Firefox (with Safari 3, the background is not transparent) Does anyone has an idea on how I could overlay a SVG ? Thanks PS1: I read some works like this or the source code of swa.ethz.ch/googlemaps, but it seems that they have to use javascript code to parse the SVG and add one by one all the elements (but I did not understood all the source...) PS2: The SVG is composed of different filled paths and circles, with transparency. If there is no solution to overlay my SVG, I can use 2 alternative solutions: rasterize the SVG convert the paths and circles in GPolygons But, I do not really like the 1st solution because of the poor quality of the bitmap and the time to generate it with antialiasing. And for the 2nd solutions, the arcs, ellipses and circles will have to be decomposed into small polylines. A lot of them will be necessary for a good result. But I have around 3000 arcs and circles to draw, so...

    Read the article

  • Silverlight: Creating a round button template

    - by Jeremy
    I decided to try making a circular button, so using expression blend, I dropped a button control on my xaml. I then created a template from it by choosing "Edit Control Parts (Template)" - "Edit a Copy". I am trying to design it so that the left and right sides of the button were always perfect semi circles, so that no matter how tall or wide the button grew, the corner radius would max out at either half the width or half the length of the button, depending on which was smaller. That way, if the button was stretched tall, the top and buttom would be perfect half circles, and if the button was stretched wide, the left and right would be perfect half circles. Is it possible to do this?

    Read the article

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