shapes

EaselJS: connect 2 containers/shapes using a line

我是研究僧i 提交于 2019-12-22 00:17:43
问题 I want to be able to click on a container/shape and as I move the mouse a line that can be connected to another container/shape (with an arrow at one end) is drawn. Ideally I want this line to snap to the destination element. I'm new to EaselJS and I've got no clue on how to go about this. This is the closes I've come across of here, and I can't make sense out of it: Drawing a Line in a html5 canvas using EaselJS 回答1: Here is a quick demo I put together The key steps are: Listen for mousedown

Area of a irregular shape

放肆的年华 提交于 2019-12-20 14:43:33
问题 I have set of points which lies on the image. These set of points form a irregular closed shape. I need to find the area of this shape. Does any body which is the normal algorithm used for calculating the area ? Or is there any support available in libraries such as boost? I am using C++. 回答1: If you polygon is simple (it doesn't have any point in common except for the pairs of consecutive segments) then wikipedia comes to help you: The formula for the area is (it assumes that the last point

Break a rectangle into randomly shaped polygons

↘锁芯ラ 提交于 2019-12-20 10:44:53
问题 Just like the title says, I need to break a rectangle into randomly shaped polygons. Example, with 7 polygons: +--------+--------+ |\ | 2 | | \ 1 |''--..__| | ------| 5 | | 3 / \________| | / /\ 6 | |__/ 4 / \______| | / 7 | +-----+-----------+ I don't know if there's an algorithm already out there for this, but I can't seem to get my head around this. I don't particularly care what language you answer in, but I'll be implementing in Java/Swing. 回答1: You may drop a bunch of random points on

Using predefined SVG file for creating a custom JointJS shape with ports

自作多情 提交于 2019-12-19 11:14:17
问题 I have a series of pre-created SVG symbols I want to use in JointJS. I've searched about using precreated SVGs and I found to be possible to create a complete custom elements using SVG by putting the SVG in the 'markup' property - (https://groups.google.com/forum/#!topic/jointjs/pQvN_0lXPVk). Below is the example of an SVG. Your help about how can I embed this definition in the markup property and add ports to it will be highly appreciated. Thanks <?xml version="1.0" standalone="no"?> <svg

Nested loops for creating a spiral shape pattern in c

ぐ巨炮叔叔 提交于 2019-12-19 10:19:45
问题 I need to make a spiral pattern made of stars '*' using nested for loops. I managed to make outter lines, now I don't know how to repeat smaller swirls in the same place. What I should have: ********* * ******* * * * * * *** * * * * * * * ***** * * * ********* Any help would be greatly appreciated. 回答1: After being thoroughly nerd-sniped, I came up with this: #include <stdio.h> void print_spiral(int size) { for (int y = 0; y < size; ++y) { for (int x = 0; x < size; ++x) { // reflect (x, y) to

How can I copy shapes from one slide to another slide in c#?

↘锁芯ラ 提交于 2019-12-18 08:57:51
问题 I need to insert shape(s) from presentation1 to presentation2. We can insert a slide like pptApp.Presentations[Presentation2].Slides.InsertFromFile("presenation1", 10,2,2); But I want only the shapes from Presentation1.slide(x) inserted to Presentation2.slide(y). How can i Do this in C#? Please help me. Thanks P2000 回答1: var origSlide = origPres.Slides[slideNum]; var destSlide = newPres.Slides[slideNum]; foreach (Shape origShape in origSlide.Shapes) { origShape.Copy(); newPres.Slides.Paste

Draw Beautiful Speech Bubbles in Swing [closed]

為{幸葍}努か 提交于 2019-12-18 04:26:14
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am trying to create beautiful speech bubbles in swing but the result is not very good...I mean I want something better and more beautiful! here is the code i'm using: import javax.swing.*; import java.awt.*; import java.awt.geom.Area; import java.awt.geom.RoundRectangle2D; public class BubbleTest

svg: generate 'outline path'

半腔热情 提交于 2019-12-17 16:14:03
问题 I have a set of coordinates that I turn into an svg path (using cubic beziers to make it smooth). When I apply a certain stroke width, I get the following result (the blue dots are my coordinates) What I am interested in is to get a path that runs around the gray shape (like: pick any point on the gray/white border, and round around the shape until you're back at the starting point). How would I go about computing such a path? for reference, this is my svg info: <g> <title>number 3</title>

Create a cross shape in CSS

心已入冬 提交于 2019-12-17 12:44:51
问题 IS it possible, I know all the following shapes are possible in this link: http://css-tricks.com/examples/ShapesOfCSS/ but cross must be possible too. When I say cross I mean like this: 回答1: You could achieve something like this with pseudoelements only: http://jsbin.com/upiyoc/1/edit #cross { width: 100px; height: 100px; position: relative; } #cross:before, #cross:after { content: ""; position: absolute; z-index: -1; background: #d00; } #cross:before { left: 50%; width: 30%; margin-left: -15

Create a cross shape in CSS

非 Y 不嫁゛ 提交于 2019-12-17 12:44:22
问题 IS it possible, I know all the following shapes are possible in this link: http://css-tricks.com/examples/ShapesOfCSS/ but cross must be possible too. When I say cross I mean like this: 回答1: You could achieve something like this with pseudoelements only: http://jsbin.com/upiyoc/1/edit #cross { width: 100px; height: 100px; position: relative; } #cross:before, #cross:after { content: ""; position: absolute; z-index: -1; background: #d00; } #cross:before { left: 50%; width: 30%; margin-left: -15