Search Unity

[RELEASED] Math Library for Unity

Discussion in 'Assets and Asset Store' started by devast3d, Feb 16, 2014.

  1. MarcoMeter

    MarcoMeter

    Joined:
    Jun 14, 2013
    Posts:
    69
    Hi devast3d,

    I'm currently working with your library. I think you forgot to implement a method to compute the intersection point of two lines. I can't find such a method for your Line3 objects in your documentation.
     
  2. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    Marco,

    Actual line intersection in 3D is generally a very rare case. In 2D lines are mostly intersecting, in 3D analogue is plane intersection. But line intersection in 3D is not really useful. Probably what you need is line distance.
     
  3. thrmotta

    thrmotta

    Joined:
    May 27, 2014
    Posts:
    32
    It seems to me that the Convex Hull 3D has a point length limit, is that true? Im asking this because everytime I use a mesh with more then ~1000 vertices I get a "Expecting Initial Vertex" error message, and later on a "Shader wants texture coordinates, but the mesh hull doesn't have them" log message. I have mostly followed your Convex 3D demo and am basicaly passing shareMesh.vertices as points for the ConvexHull.Create3D method.
     
    Last edited: Jan 28, 2015
  4. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Finally got around to checking out this package and dang does it look comprehensive! There's something I'm trying to do that I can't quite figure out how to accomplish with your package: I want to bound a 3d point within a 3d planar polygon, the point generally not within the plane; basically, I want to find the point on the planar polygon nearest the 3d point.

    My current thinking is running to projection followed by multiple line distance tests but I'm wondering if there's a simpler way...
     
    Last edited: Feb 8, 2015
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The problem with shipping just a .dll is that you exclude thousands of free users from purchasing? Does it work with all platforms? how about webplayer?
     
  6. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    @thrmotta
    Can you please send me the mesh you're using for the investigation? Please use PM for that.

    @Alphalpha
    Doing projection is the good idea I think. After projecting into 2D you can use Point2-Triangle2 distance test which will give you the closest point.

    @hippocoder
    The library uses vectors, matrix, mathf and debug Unity types. The code itself is just C#, I guess it should work everywhere, got no complains so far about it. For a web demo you can find the link in this post.
     
  7. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    As of 1.3.4 the library includes all source code! The dll is still shipped. If you want to use sources then unzip the archive with sources and delete the dll.
     
  8. VerichronGames

    VerichronGames

    Joined:
    Apr 13, 2015
    Posts:
    4
    Out of curiosity, can methods in the math library be used to determine which side of a square is closest to me, and also which point on that side is closest? Ie. detecting the range of an object, not by the point in it's center, but by it's bounding box.

    I currently test to see which corners are closest, though this doesn't work in the case of something like this:

    I'm only concerned if any part of the box is within a certain distance. Can I also do this with irregular shapes?
     
  9. ArthurClark

    ArthurClark

    Joined:
    May 12, 2013
    Posts:
    15
    This is what Asset Store told me when I tried to buy this asset. I'm using Unity 5. Could you confirm that your asset works fine on this version of Unity? Thank you!
     
  10. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    VerichronGames
    You can use Box2-Circle2 for the intersection test. As for the actual point try Segmen2-Circle2 for every side of the box and get the closest point.

    ArthurClark
    The library mostly consist of non-MonoBehaviour scripts. Anyway to avoid further confusion I've submitted the update which adds separate Unity5 version.

    For ruther assistance please write to mathlibrary@deststudio.com
     
  11. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hi

    Just bought your library to be able to create 3D convex hull meshes based on 3D points.
    It generates the shape just fine, but it doesn't look right when adding a material to it.
    upload_2016-9-25_13-49-43.png
    It also seems to lose the detail of the (grass) texture of the material (see small cube as reference)

    Any ideas?
     
  12. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Does it contains method for extracting contact point normal?
     
  13. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    I add Test_Triangle2.prefab into Hierarchy ,it can display in the scene view,
    but it can't display in the game view. I don't know why.
     
  14. xunustar

    xunustar

    Joined:
    Dec 7, 2017
    Posts:
    3
    Hi, are you there? I have some problem in Poisson Disk Sampling but in your document is lack of it, could you give some tutorial about this technique, tks so much
     
  15. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    Responded to PM.
     
  16. xunustar

    xunustar

    Joined:
    Dec 7, 2017
    Posts:
    3
    I have sent you email, please check it for your convenient, thank you !
     
  17. xunustar

    xunustar

    Joined:
    Dec 7, 2017
    Posts:
    3
    In your email you said: Poisson has not available for random mesh yet, i know, but i mean: if i have another object such as an oil film (static state not move) so I can apply your algorithm on it?
     
  18. wechat_os_Qy0zhRtDl5yEhWzrOcbO_MrD8

    wechat_os_Qy0zhRtDl5yEhWzrOcbO_MrD8

    Joined:
    May 2, 2019
    Posts:
    1
    Sir, there is no interface for finding intersection, Union and difference sets of any two polygons in the mathematical library.
     
  19. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    There are no boolean operations over polygons.
     
  20. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    187
    @devast3d Hi, whats the licence model of this awesome lib? Are we allowed to redistribute destMath.dll it in our projects straight away ? I assume so but it would be great to have some official statement from you like "its MIT , son" or such :)
    Thanks for this hard work, its really useful.
    If you have time , could you please recompile it for .Net 4.x ? There are also some warnings about obsolete elements when using the package in Unity 2019.x but they seam not related to the destMath.dll
     
  21. devast3d

    devast3d

    Joined:
    May 30, 2010
    Posts:
    76
    The licensing is the same as the store dictates, so I guess you can.
    Also, the package contains library source code, you can recompile it however you'd like!
     
  22. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    156
    Hi devast3d!
    Sorry, I'm using your Lib. How to know, do 3D triangle contains a poin or not?