This is the discussion forum for Helix Toolkit.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0

How to tell TextVisual3D dimensions

Michael Powell 11 years ago updated by ไอยดา สุรีวงค์ 4 years ago 8
I want to determine the size, length or width, of a block of TextVisual3D, especially for purposes of measuring and placing it in a scene. Is this possible? I don't see it in the TextVisual3D itself. Would it be possible to coordinate that issue embedding a text in a RectangleVisual3D in the appropriate dimensions, UpDirection, TextDirection, etc? However, along these lines, I'm not sure I see any options for HorizontalAlignment or VerticalAlignment, i.e. 'Stretch'.
0

MeshBuilder Revolve WPF Lines

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mcrxb wrote at 2012-01-18 18:43:

Hello,

Is it possible to use MeshBuilder to create a revolved mesh from WPF lines and arcs?

Thank you!


objo wrote at 2012-01-18 18:50:

see the AddRevolvedGeometry method:

public void AddRevolvedGeometry(IList<Point> points, Point3D origin, Vector3D direction, int thetaDiv)
This creates a mesh from a 2D curve and an axis of revolution (x coordinates are radius and y coordinates are distance along the axis). ThetaDiv specifies the number of points around the mesh.


mcrxb wrote at 2012-01-23 13:24:

Thanks for the quick reply. I was wondering, though, if I could take a WPF object like Path and revolve that. If not, do you have a small sample app that utilizes MeshBuilder for creating revolves? I couldn't find any uses in the sample applications.

Thank you.


objo wrote at 2012-01-26 20:07:

Most of the Visual3D classes in the toolkit is using the MeshBuilder to generate the geometry. See the ArrowVisual3D.Tesselate() method (using an AddArrow method that again uses AddRevolvedGeometry).

No, the revolve method is not accepting Path objects (this would be more work to support all the different path segment types), it just takes a simple list of points. 

0

Camera view of rectangles

Nit29 10 years ago 0
Hi

I am new to 3d manipulation esp with helix toolkit.
Am trying to have a camera fixed to a side of rectangle. When the rectangle is rotated or moved, the camera should relatively change it's view. Is there any property that ties the camera to an object or a specific vector of an object? Also, there will be 2 rectangles used as planes intersecting making an 'X' shape from the top view. So there has to be 2 views of one side of each plane and a top view.

I am looking forward to understand a way to make this work.Thanks!
0

Display the 3D mesh

Anonymous 11 years ago 0
This discussion was imported from CodePlex

kirru wrote at 2013-11-16 10:06:

Wishes everyon,
                   I loaded the .obj file into WPF visual c# application, now the issue is how to display the mesh generated by that .obj file using Helix tiilkit. Any help is appreciated.

objo wrote at 2013-11-19 22:27:

Have a look at the examples on how to create a "HelixViewport3D" and add a .obj file model!
See Source\Examples\SimpleDemo and Source\Examples\ModelViewer and http://www.nudoq.org/#!/Packages/HelixToolkit/HelixToolkit.Wpf/ObjReader
0

Two questions on Manipulator

Anonymous 11 years ago 0
This discussion was imported from CodePlex

damianoslebo wrote at 2013-02-12 01:36:

Hi I am using the code behind with manipulators in my program with the following code:
        CubeVisual3D box = new CubeVisual3D();
        box.Center = new Point3D(x, y, z);
        CombinedManipulator boxManipulator = new CombinedManipulator();
        boxManipulator.Position = box.Center;
        boxManipulator.Pivot = box.Center;
        boxManipulator.CanRotateX = false;//true;
        boxManipulator.CanRotateY = false;// true;
        boxManipulator.CanRotateZ = false;// true;
        boxManipulator.CanTranslateX = false;// true;
        boxManipulator.CanTranslateY = false;// true;
        boxManipulator.CanTranslateZ = true;
        boxManipulator.Bind(box);
        vp.Children.Add(boxManipulator);
        vp.Children.Add(box);
        globalManipulatorList.Add(boxManipulator);
I can get the manipulator to work in the x and y and all rotation directions, however the Z translate direction does not show up on the viewport. I don't know why the other directions work but Z does not work.

The second question is what event can invoke when using a transparent bounding volume to detect a mouse left button down on the manipulator? I have been using the VisualTreeHelper.HitTest method to ignore transparent geometry before now but I don't know what method can be invoked once a manipulator is found by the VisualTreeHelper.HitTest method.

Thanks for the help,
Damian

objo wrote at 2013-03-12 11:41:

1: Thanks for the notice - I see some change had broken the TranslateManipulator. I removed the default value of the Direction property, now it seems to work again.

2: Sorry, I don't quite understand the problem here. Please make an example that we can debug!

0

Manipulators to stretch and move box

Anonymous 11 years ago 0
This discussion was imported from CodePlex

christianw42 wrote at 2013-06-17 14:03:

Hello everybody,

i have a little problem with adding manipulators to an visual via code, in my case a BoxVisual3D.

I define a box an two manipulators, one for moving, one for resizing:
var volumeBox = new BoxVisual3D();
volumeBox.Center = new Point3D(0, 0, 0);
volumeBox.Length = 0.3;
volumeBox.Width = 0.3;
volumeBox.Height = 0.3;
volumeBox.Material = MaterialHelper.CreateMaterial(Colors.SkyBlue, 0.3);

var xManipulator = new TranslateManipulator();
xManipulator.Color = Colors.Red;
xManipulator.Length = 0.4;
xManipulator.Diameter = 0.02;
xManipulator.Position = new Point3D(0, 0, 0);
xManipulator.Direction = new Vector3D(-1, 0, 0);
xManipulator.Offset = new Vector3D(-1, 0, 0);
xManipulator.Bind(volumeBox);

var xStretchManipulator = new TranslateManipulator();
xStretchManipulator.Color = Colors.SpringGreen;
xStretchManipulator.Length = 0.3;
xStretchManipulator.Diameter = 0.02;
xStretchManipulator.Position = new Point3D(0, 0, 0);
xStretchManipulator.Direction = new Vector3D(-1, 0, 0);
xStretchManipulator.Offset = new Vector3D(0, 0, 0);
//xStretchManipulator.Bind(volumeBox);

var binding = BindingOperations.SetBinding(
xStretchManipulator, TranslateManipulator.ValueProperty, new Binding("Length") { Source = volumeBox, Converter = new LinearConverter { M = 0.5 }});
binding.UpdateTarget();

//var targetBinding = BindingOperations.SetBinding(
//    xStretchManipulator, TranslateManipulator.TransformProperty, new Binding("Transform") { Source = volumeBox });
//targetBinding.UpdateTarget();
            
//var targetTransformBinding = BindingOperations.SetBinding(
//    xStretchManipulator, TranslateManipulator.TargetTransformProperty, new Binding("Transform") { Source = volumeBox });
//targetTransformBinding.UpdateTarget();
The code above works fine for resizing and moving the box, but the manipulator for resizing (xStretchManipulator) does not move with the box. When I add the transform-bindings to the xStretchManipulator, it moves with the box, but position is always in the center of the box and when you stretch to much, manipulator is inside the box.

Does anyone have an idea how to define and bind the manipulators, so that it works correctly?

Thanks a lot for any help or ideas!
christian
0

The SharpDX Helix 3D fork

Anonymous 11 years ago 0
This discussion was imported from CodePlex

lavagin wrote at 2013-06-10 21:50:

Hello,

Where can I find this fork? I would like to take a look at it.

Also you will be able to make metro apps with this fork?

objo wrote at 2013-06-11 04:38:

click: SOURCE CODE -> FORKS -> sharpdx
currently it is only WPF
0

Monster memory leak on window resize for SharpDX build.

Anonymous 11 years ago 0
This discussion was imported from CodePlex

noemata wrote at 2014-03-19 20:28:

Has anyone looked into the memory leak that is tripped by window resize events for the SharpDX build? With each resize several MB get lost.

Strangely the leak appears to accumulates on a TextBlock control.

objo wrote at 2014-04-29 10:52:

I have forwarded this issue to the guys working on this fork!
0

Simple sample to make objects in code

Anonymous 11 years ago 0
This discussion was imported from CodePlex

mentalarray wrote at 2012-03-27 03:13:

Hi well done for such a great project...

I just wondred whethr there is a sample to add/make objects from scratch in code, i have seen the Mvvm demo but was interested in another more simpler way

Much thanks...


murray_b wrote at 2012-03-27 05:21:

How simple?

In the MVVM example it creates a observable collection

�public ObservableCollection Objects { get; set; }

Binds it to the itemsource of the Viewport

then adds objects to it in code.  Ie Objects.Add( new #any of the Visual3d objects#)

objects.add (new TubeVisual3D
                           {
                               Path = polygonPoints,
                               Material = MaterialHelper.CreateMaterial(tubeColor),
                               BackMaterial = MaterialHelper.CreateMaterial(tubeColor),
                               Diameter = 0.1
                           });

Does that help? Let me know if that doesn't make sense

or do you want a non-mvvm. If so just add objects in code behind to the itemsource

 

 

 


mentalarray wrote at 2012-03-27 17:20:

Oh brill thanks murray_b just what i needed

0

Port to Winform and SharpGL?

Anonymous 11 years ago 0
This discussion was imported from CodePlex

tingspain wrote at 2013-04-25 02:55:

Hello,

First of all, I would like to say that GREAT JOB. I have checked the demo apps and it is very impresive work.

I was wondering if it is possible to easy port this library to Winform and SharpGL?

I dont know too much about WPF.

Thanks in advance.

objo wrote at 2013-04-25 11:31:

This library targets WPF only and is based on the System.Windows.Media.Media3D classes.
Sorry, there are no plans to port to Windows forms and OpenGL.

RobPerkins wrote at 2013-04-25 18:07:

Is SharpGL even being maintained by anyone any longer?

przem321 wrote at 2013-04-25 23:16:

Well, but there is a DirectX 11 version with SharpDX coming up, isn't it?

objo wrote at 2013-04-26 00:01:

Yes, WPF+SharpDX/DX11 (and maybe Windows Store App+SharpDX) is the direction I would like to see this project moving!
Keep up the good work on the sharpdx fork, Przem!

tingspain wrote at 2013-04-26 01:02:

It a pity that is not plan to port it to winform at least. The last time that SharpGL was updated was on Jan 30, 2013.

I looked around very fast the source code of Helix 3D toolkit, and I found get my lest a little lost. I am not familiar with WPF. Do you think that it will be very hard to port to Winform + SharpGL or SharlpDX?

Maybe I can start the porting the code.

objo wrote at 2013-04-26 22:19:

It would be interesting to port the functionality that could be platform independent (importers/exporters, camera manipulation, geometry classes) to a portable class library. The same code could then be used for both WPF, SharpDX, OpenTK and SharpGL based projects!

tingspain wrote at 2013-04-27 04:38:

Objo, I dont mind to start that project. If you give me some hint and guidance. I will do it without problem.

objo wrote at 2013-05-08 15:48:

I would like to see the file importers/exporters refactored to be platform independent, and sharing the same design pattern. The geometry / mesh generation classes are probably not so good candidates, since these should use the platform's Point/Vector structures for performance...
Feel free to start a fork on this! I wish I had time to follow up, but I'm focusing on other tasks at the moment.

RobPerkins wrote at 2013-06-18 19:47:

I did some preliminary work on this kind of thing (geometry/mesh generation) with an intern about four years ago, and I still have the C# code he did. It seems to me that platform independence could probably be done with a helper static class, making attached methods, one for each kind of library.

Does the architecture make sense in terms of Helix?

objo wrote at 2013-06-18 22:20:

It would be great to see different solutions how this can be achieved without duplicating code on the different platforms! I have not been thinking of a static class with attached methods, please post some examples.

I think performance is important for the mesh generating code. I think this means that platform specific data types (e.g. point, quaternions, transformations) should be used as much as possible, but it is possible that the platform specific data types do not need to be exposed in the public interfaces.

RobPerkins wrote at 2013-06-18 23:16:

Pardon my incorrect use of jargon: What I meant was "Extension methods". Enabled by the .NET Framework, an extension method is decorated with the [Extension] attribute (which might only be a VB.NET requirement), declared static, and takes as its first argument an argument of the type which it extends. For example (from MSDN documentation):
namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' }, 
                             StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }   
}
Which is then used by declaring using ExtensionMethods and:
string s = "Hello Extension Methods";
int i = s.WordCount();
I note that you have four such classes in the code base which I have (privately) forked for my own use.

What strikes me as interesting is that almost every 3D implementation uses a unique type name for its points, quaternions, and transformations, but the actual structure of the structs or class data have to be identical or nearly so. For games, performance of mesh generators is not vital; under the only architectures I can think of, most of those are loaded or preloaded before a high framerate is needed in the game. For engineering use cases, a high triangle count plus a relatively low framerate (mouse gesture animations, mostly) are the order of the day.

Frankly, for most mesh generation, I'm writing my own code against my data models and emitting the WPF formatted arrays and assigning them to the various Visual3Ds I use from the Helix library. So what I'm thinking about is extension methods like "ToOpenGL--structure--" or "ToSharpDX--whatever--" which would take the WPF structures native to Helix and emit the ones compatible with the other libraries. With a modern i5 or i7 and TPL it wouldn't even be computationally time consuming to execute such functions unless the facet counts were in the millions.

For my engineering based low-frame-rate, medium-delay-tolerant use cases, such an approach would not be so bad. I may give this more thought; the OpenTk stuff looks very, very compelling for non-WPF reasons.