WPF-I have circle plotted point in XL - wpf

I have a three point circle points in XL/Report.With the help of saved circle point in Xl want to draw the same circle in WPF canvas.Is any body has any idea ,how we can draw the circle if we know the circle points.

There is no built in support for this that I know of. I'm afraid you will have to do the math yourself. This site will give you the equations you need.
http://csharphelper.com/blog/2014/08/draw-a-circle-through-three-points-in-c/
Once you have the center, width, and height, you can use the WPF Ellipse to render it to your canvas.

Related

Draw curves to make arrows in the Codename One GlassPane

In a CodenameOne App, I need to draw curved arrows in the GlassPane. The use of the GlassPane is not mandatory, however I've already used some layers in the ContentPane and some layers in the LayeredPane, so I suppose that the GlassPane is the best option to be sure that the arrows are "over" the app.
The arrows should be like the following ones:
I suppose that I can create an algorithm that decides the absolute X and Y coordinates of the "Start" and "End" points, more other few points (P0, P1, P2, etc.), that describes the curves. For example:
My problem is that I don't know how to do it. Usually I don't need low-level drawing in a Codename One app like in this case. Could you please show me a correct and complete code to do this drawing (assuming to know the coordinates of Start, End, P0, P1, etc.)? Thank you.
This is a bit hard to do by hand. I would suggest using SVG to draw an arrow like this by using a tool such as Sketch or a similar vector graphics tool. Then using flamingo to convert it to an image: https://www.codenameone.com/blog/flamingo-svg-transcoder.html
Alternatively you can handcode it with a GeneralPath e.g.:
GeneralPath gp = new GeneralPath();
// move to start of path
gp.move(x, y);
// draw the curve of the arrow, we use a control point around which
// the curve is drawn and curve to the destination of the line
gp.curveTo(contolX, controlY, destX, destY);
// Stroke defines how the shape is drawn it accepts the line width
// cap style, join style and miter limit
Stroke st = new Stroke(2, Stroke.CAP_SQUARE, Stroke.JOIN_MITER, 1);
// red
graphics.setColor(0xff00000);
// now we can draw the shape
graphics.drawShape(gp, st);

How can I animate process 1 circle transform to other and create a shape along the way in WPF?

I have a task with WPF 3D Animation:
I have 2 circle with known center point, radius, and perpendicular with the known vector.
The circle 1 will need to smoothly 'transform' to circle 2 and I want to animate that transform process and create a shape along the way (a twisted tube with different radius).Anyone has idea or suggestion code to achieve this?
Thanks in advance.

WPF 3D transparent textures - clipping?

http://www.youtube.com/watch?v=gZNdfVwkttM - you can see all of the problem described on this video if you can't see pictures.
All of walls in all images below have a semitransparent PNG texture. Each square wall, floor and ceiling tile is a separate GeometryModel3D (I know that is no good for performance but...). The floor and the ceiling of the central cube have no any geometry and textures - so they have a color the same as Window.Background (black). But the effect considered appears in any way of transparency obtaining: texture for ImageBrush with transparency, Material.Color (for example DiffuseMAterial.Color) where Color has alpha channel, ImageBrush as material where ImageBrush has Opacity - all the way I have the same problem.
All of walls consists of two triangles. Where are no explicit normals , because I define triangle indices so normals culculated automatically by WPF.
http://imagepost.ru/images/i/ma/image00001.png
It also haven't any back material or extra triangles from the back side.
As you can see there is no problem if you look only from +Z to -Z (standing on the blue square and looking to the red square - that is the second picture).
But if you look backward (from red to blue - the first picture) there is no transparency!
Well, I desided to look from the yellow square (third picture).
And then I walked nearer - you can see what was happening (pictures from 4 to 6).
There are no geometry construction error or texture mapping error or lighting error! It is some kind of clipping, I guessed! In addition there are some interested pictures 7 and 8 to prove my guess.
The last picture shows the white background of the window that hosted Viewport3D (previous was black), and my guess about clipping confirmed - WPF just not painted this part of the scene and we can see the window background!
BUT! If this happens from various looks, why the look from +Z to -Z (second picture) seems well?!
You need to sort the triangles based on their distances from the viewpoint. Only then, wpf will be able to blend the transparent textures.
DirectX is able to blend triangles on top of each other but only when drawing them back to front
http://www.ericsink.com/wpf3d/2_Transparency.html

Converting equations of motion to pixels for display on Silverlight canvas

Can anyone point me in the direction of some information to understand this. I have a Canvas that displays an ellipse. I can move the ellipse around using the keyboard but I want to simulate a "jump", so I thought I'd use Newtons equations of motion to move the ellipse up and then down when the user presses the up arrow. All these equations are defined in metres where as the TranslateTransform on the UserControl is in pixels.
Can I get the resolution in SL to convert from metres to pixels?
Not really, no. Silverlight doesn't understand pixels.
There are 96 units in an inch (no matter the dpi of the display). That suggests there are 3779.5 silverlight units in a metre. I'd think about applying a ScaleTransform to any area you're displaying so you can give Silverlight metres and get the right visuals out if that matters to you.

Draw circle around a white area in OpenCV (C language)

how can I draw a circle around a white space in a image file with OpenCV (C language)?
image example:
thanks a lot!
First you can use FindContours to find all (in your case 1) contours (blobs/regions) in the image, then you can draw a circle or any other shape you want around the contour.
Edit: To draw a circle you can use Circle.
you can compute moments first, then get circle info from it.
You don't really need opencv for that, you just loop over your image and calculate the bounding box surrounding the white blob, get the center and the radius of your circle is the length from the center to any corner. Then just use GDI or something to draw your circle.

Resources