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

Is it possible to find distance between camera and a mesh?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

behnam263 wrote at 2014-07-25 21:00:

I need to know that is it possible to measure distance between camera position and mesh position?(for example camera position to center of mesh)

BogusException wrote at 2014-07-25 21:31:

@behname263,

If you mean the center of the mesh, there has to be at least 2 ways to use the mesh center as origin and camera position in 3d in a simple trig function... as in this example...

Or are you talking about the nearest point/vertices to the camera?

This may help as well, not knowing the actual issue: Fitting view with perspective camera
0

How to limite camera zoom In/Out

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Moez_rebai wrote at 2014-07-18 12:24:

I'm trying to visualize a mesh using Helix 3D, it works fine, the only problem i got is how to limite the HelixViewport3D camera zoom. In fact, sometimes my model disappear when i zoom in or out.

Before Zoom :


After Zoom


Any idea how can i solve that issue
Regards,

everytimer wrote at 2014-07-18 20:54:

Have you tried PerspectiveCamera instead of Orthographic one?
0

How to control the trackball via code?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

zoras1986 wrote at 2013-04-21 23:25:

Hello everyone,
i'm starting my project from the contour demo samples of this awesome tool, but i cannot figure out how to control the trackball (don't know if is right call it like this, i mean the cude with the face "L, B, U, R, S..") by code in a wpf application (so c#). i can't figure out if it's something about the camera (view1.SetView(...)). or the model (model1.transform(...))
can someone help me?
a little piece of code
   <ht:HelixViewport3D x:Name="view1" Camera="{ht:PerspectiveCamera 5.3,-12.3,3.3,-6.3,11,-6.6}" CameraChanged="view1_cameraChanged" ShowCameraInfo="True"  Margin="0,71,0,0">
        <ht:SunLight/>
        <ht:FileModelVisual3D x:Name="model1" Source="D:/MARCO/Onthebrain/WPF - 3D - Kinect/Contour sample di Helix/Contour_demo/Contour_demo/bin/Debug/Astronaut.3ds"/>
    </ht:HelixViewport3D>
inside a grid...
in the .cs file i want to simulate the "right mouse click + mouse movement" input, as in the example, but in code...
thanks!
0

GridLinesVisual3D

Anonymous 10 years ago 0
This discussion was imported from CodePlex

murray_b wrote at 2012-05-10 04:35:

Hi Objo

Can I please request you make widthDirection propery public on this class like the lengthDirection.

I would like to use it for placement of labels at all the grid intersections.

Thanks

Murray


murray_b wrote at 2012-05-10 05:01:

Actually don't worry. Another day of stupidity for me

I just found your code

 this.widthDirection = Vector3D.CrossProduct(this.Normal, this.lengthDirection);



0

How to Draw a Funnel

Anonymous 10 years ago 0
This discussion was imported from CodePlex

AQSRanck wrote at 2014-06-25 02:38:

I wonder if anyone could suggest an approach to drawing a funnel?

objo wrote at 2014-06-25 09:55:

See the usage of MeshBuilder.AddSurfaceOfRevolution in the example Source\Examples\WPF\ExampleBrowser\Examples\BuildingDemo\SiloVisual3D.cs, I think a similar approach can be used to model a funnel.

AQSRanck wrote at 2014-06-25 13:59:

Thank you very much. I have been using Helix for several months in an application that is designed for the residential construction market. I would rather not publish the results yet but if you would send me a direct email, I will share a number of screen shots with you. I am most grateful for your work and "brag" about both Caliburn Micro and Helix (which are both in the same class of excellence) at each of the Microsoft meetings that I attend.

Bob

AQSRanck wrote at 2014-06-26 04:15:

Hello objo,

Thank you for your suggestion, I should not have much trouble creating a FunnelVisual3D. But I have hit a real snag. I work in VB rather than C# so I need to write my own version of theSiloVisual3D. However, I don't understand the lambda contained in the Dependency property, shown below.
public static readonly DependencyProperty DiameterProperty =
      DependencyPropertyEx.Register<double, SiloVisual3D>("Diameter", 40, (s, e) => s.AppearanceChanged());
My version for VB will look about like this: (However the lambda is not quite right)
Public Shared ReadOnly DiameterProperty As DependencyProperty =
     DependencyPropertyEx.Register(Of Double, SiloVisual3D)("Diameter", 40, Function(s, e) s.AppearanceChanged())
I'm not asking for you to fix my code, but rather to help me understand the C# version, so that I can fix the VB version myself.

Once I master SiloVisual3D (in VB) I fully expect to create an entire library of specialized visuals for my needs, so getting past this snag is kind of important for me.
Now that I see this example from Building Demo, the funnel shape should not be to hard.

Bob

objo wrote at 2014-06-26 05:43:

Sorry I don't know how to write the lambda in VB.
But you could change to standard dependency property registration with DependencyProperty.Register, see http://msdn.microsoft.com/en-us/library/ms750428(v=vs.110).aspx
Make sure you add the property changed calback to the metadata.

RobPerkins wrote at 2014-06-26 17:15:

Bob,

Try:
Public Shared ReadOnly DiameterProperty As DependencyProperty =
     DependencyPropertyEx.Register(Of Double, SiloVisual3D)("Diameter", 40, Sub(s, e) s.AppearanceChanged())
(because the lambda is supposed to be a function returning "void" (in C# terms) and in VB, that's represented with a Sub() lambda instead of a Function() )

AQSRanck wrote at 2014-06-26 17:45:

DOH!
Would you believe that I spent the better part of a day because I forgot that rule.
Thank you very much Rob
0

HelixViewport3D's camera commands -- XAML bindings possible?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

RobPerkins wrote at 2012-10-02 04:51:

I've gotten myself lost again. 

Well, not that lost; my application is using the HelixViewPort3D, which of course comes with the ViewCube and key bindings for orienting views. That's working perfectly. 

Now I have other UI elements *around* the HelixViewPort3D in the same UserControl which I'd like to configure to send commands to the HelixViewPort3D's camera controller. I had thought to do this with three buttons formatted something like this: 

 

            <dxb:BarButtonItem Content="XZ Front View" Command="{x:Static h:CameraController.FrontViewCommand}" CommandTarget="{Binding ElementName=VP, Path=CameraController}" />
       
... where VP is the name of the HelixViewPort3D in the same UserControl. It's not working. The buttons register in design mode as if the binding is correct (that is, the UI appearance goes from disabled to enabled) but at runtime the buttons behave as though CanExecute is returning false!

I'm not sure how to proceed, or whether it's possible. The CameraController exposes a RoutedCommand named "FrontViewCommand" so I thought this syntax would work. 

Any ideas? 


RobPerkins wrote at 2012-10-02 05:14:

Never mind; exactly those XAML bindings work... if the focus is on the ViewPort. This is the only Viewport in the control, though, so I'm not sure why an automatic CanExecute isn't being routed through...

0

Need Scaling Help

Anonymous 10 years ago 0
This discussion was imported from CodePlex

matthewfrazier wrote at 2010-10-12 17:23:

I'm trying to create a simple tube which I can do fine using this wonderful toolkit.  What I'm having a problem with is perspective or scaling.  Using the given array list of xyz coordinates I draw my tube BUT I can't make it "look right" in my view. I tried dividing by 1000 but that obviously just keeps the same problem just on a smaller scale.  My issue is that my z coordinate is always going to be much larger than my xy.   I want to create a tubing path for my users to view so they can see the deviation of the tubing.  I can do this with a simple xyz scatter plot in winforms but I want to be able to have the 3D camera control in WPF to give the users more perspective.  Any ideas?

private void LoadArrayList()
        {
            _x = new ArrayList() { 0, 1.31, 2.71, 3.06, 3.48, 4.69, 6.8, 9.51, 12.37, 15.75, 19.65, 23.76, 30.21, 38.89, 47.77, 56.81, 69.86, 78.23, 86.62, 96.26, 107.4, 117.4, 125.63, 133.91, 142.02, 148.47, 152.32 };
            _y = new ArrayList() { 0, 4.76, 7.19, 6.56, 6.76, 8.31, 11.66, 16.48, 22.3, 29.07, 36.08, 43.1, 54.16, 69.78, 85.66, 101.81, 124.95, 140.06, 154.96, 169.97, 185.11, 198.52, 210.58, 222.8, 235.48, 245.87, 251.77 };
            _z = new ArrayList() { 0, -463.96, -775.94, -901.94, -964.94, -1027.91, -1091.78, -1155.54, -1217.2, -1279.74, -1342.23, -1404.7, -1497.83, -1622.55, -1747.23, -1872.88, -2060, -2184.81, -2309.64, -2434.37, -2558.96, -2683.84, -2808.99, -2934.12, -3059.22, -3161.49, -3221.08 };
        }

        private void BuildTube()
        {
            var pc = new Point3DCollection();
            for (int i = 0; i < (_x.Count); i++)
            {
                pc.Add(new Point3D((Convert.ToDouble(_x[i]) / 1000.00) * 5, (Convert.ToDouble(_y[i]) / 1000.00) * 5, (Convert.ToDouble(_z[i]) / 1000.00) * 5));
            }
            tube.Path = pc;
        }

objo wrote at 2010-10-13 08:09:

can you change only the scale of the z-coordinates?

  var _x = new List<double> { 0, 1.31, 2.71, 3.06, 3.48, 4.69, 6.8, 9.51, 12.37, 15.75, 19.65, 23.76, 30.21, 38.89, 47.77, 56.81, 69.86, 78.23, 86.62, 96.26, 107.4, 117.4, 125.63, 133.91, 142.02, 148.47, 152.32 };
  var _y = new List<double> { 0, 4.76, 7.19, 6.56, 6.76, 8.31, 11.66, 16.48, 22.3, 29.07, 36.08, 43.1, 54.16, 69.78, 85.66, 101.81, 124.95, 140.06, 154.96, 169.97, 185.11, 198.52, 210.58, 222.8, 235.48, 245.87, 251.77 };
  var _z = new List<double> { 0, -463.96, -775.94, -901.94, -964.94, -1027.91, -1091.78, -1155.54, -1217.2, -1279.74, -1342.23, -1404.7, -1497.83, -1622.55, -1747.23, -1872.88, -2060, -2184.81, -2309.64, -2434.37, -2558.96, -2683.84, -2808.99, -2934.12, -3059.22, -3161.49, -3221.08 };
        
  var pc = new Point3DCollection();
  for (int i = 0; i < (_x.Count); i++)
            {
                pc.Add(new Point3D(_x[i], _y[i], _z[i]*0.01));
            }
  tube.IsPathClosed = false;
  tube.Path = pc;
Note that you should interpolate your data to get a smooth tube where there are sharp bends - the tube code is currently only extruding a circle along the given data.  

0

Assembly not found

Anonymous 10 years ago 0
This discussion was imported from CodePlex

dcrysty23 wrote at 2014-08-12 12:45:

Helix 3D Toolkit library I downloaded and tried to use it in my project but I get this error.

"Assembly HelixToolkit.Wpf was not found"

"Assembly HelixToolkit.Wpf.Input was not found"

This is code xaml:
 xmlns:helix="clr-namespace:HelixToolkit.Wpf;assembly=HelixToolkit.Wpf"
 xmlns:helixInput="clr-namespace:HelixToolkit.Wpf.Input;assembly=HelixToolkit.Wpf.Input"
I put a picture to see that I added the anssembly

http://i60.tinypic.com/jp989k.jpg
0

Helix Toolkit with Kinect -Beginner

Anonymous 10 years ago 0
This discussion was imported from CodePlex

shaelyn wrote at 2014-02-28 14:40:


Click to view the photo
I opened the HelixToolkit.Kinect.sln and I didn't make any changes on the coding.
I got these errors when I built the solution. Any idea why is this happens?
0

HelixViewport3D rendersize change

Anonymous 10 years ago 0
This discussion was imported from CodePlex

iLovePasta wrote at 2013-01-20 10:34:

Hi,

is there any possibility to change dimensions of rendered *.jpg file from HelixViewport3D. It seems to me, that it adjusts dimensions of exported image according to current ViewPort size. But I'm not able to change these via none of it' properties like Width, RenderWidth, even a ScaleTransform does not seem to make things happen.

Do You know how is possible to change export sizes? Typical use case - I want to export in, say, 800x600 & 1024#768 resolution etc.

Thanks.

 

edit: It looks like I'm spamming here:), but it's my second post & again...after trying to resolve the problem like for an hour or so, I wrote here & suddenly after few minutes, I figured out how to do this.

 

If somebody is interested in future - You have to access HelixViewport3D's property ViewPort, where You shold define rendersize property.


objo wrote at 2013-01-23 20:32:

Thanks for posting the solution to your problem.

I think the Viewport3DHelper.RenderBitmap method should be overloaded with a method where you can specify the width and height.

Did you also notice the "oversampling" multiplier feature in that method? It is good for software rendering!