I am creating a mesh export/import plugin for Maya.
When I create a mesh with MFnMesh.create, the mesh always has softened edges. If I export meshes that have all hardened edges, the results seems like wrong meshes. So I try to do additional "polySoftEdge" command, but it takes considerable time for complex meshes. So I want to know the way to create a hardened edges on the stage of creation.
When you create the mesh you can set the edges in the API using the SetEdgeSmoothing() function for every edge followed by a single call to cleanupEdgeSmoothing() and then updateSurface() to rebuild the mesh with hard edges.
Relevant Docs
Related
Is there a way in JGraphT that I can assign multiple weights to a single edge? For example, suppose I have a graph representing travel-time between cities. I want to assign edge-weights for "time by plane", "time by car", "time by bus", etc., and then find least-cost route by some specified mode of travel.
One approach I can think of is to have distinct graph for each travel mode and then add every city vertex to every graph but that seems like a messy and memory intensive solution.
My next thought was that I might be able to extend the class implementing the graph ( probably DirectedWeightedPseudograph) and customize the getEdgeWeight() method to take an additional argument specifying which weight value to use. That, however, would require extending all the algorithm classes as well (e.g., DijkstraShortestPath) which I am trying to avoid.
To get around that problem I considered the following:
Extend my Graph class by adding a method setWeightMode(enum mode)
customize the getEdgeWeight() method to use the currently assigned mode to determine which weight value to return to the caller.
On the plus side it would be 100% transparent to any existing analysis classes. On the negative side, it would not be thread-safe.
At this point I'm out of ideas. Can anyone suggest an approach that is scalable for large graphs, supports multi-threading, and minimizes the need to re-implement code already provided by JGraphT?
There exists a much easier solution: you want to use the AsWeightedGraph class. This is a wrapper class that allows you to create different weighted views of an underlying graph. From the class description:
Provides a weighted view of a graph. The class stores edge weights internally. All getEdgeWeight calls are handled by this view; all other graph operations are propagated to the graph backing this view.
This class can be used to make an unweighted graph weighted, to override the weights of a weighted graph, or to provide different weighted views of the same underlying graph. For instance, the edges of a graph representing a road network might have two weights associated with them: a travel time and a travel distance. Instead of creating two weighted graphs of the same network, one would simply create two weighted views of the same underlying graph.
I've started my journey of making an interactive gallery using react-three. I already have the First-Person mechanics figured out and I made a small room to walk and interact. I want to escalate the environment but since I can't make 3D assets, I bought this https://sketchfab.com/3d-models/vr-art-gallery-el5-e3bda3a7086c49f0a84948fd6808bcf4 .
So..what's the logic to add colliders to the walls so I can't cross and floor so I can walk, using react-three/cannon?
Welcome to Stackoverflow Mickael, so your idea can be achieved by using a nav mesh. There's a popular library for this called three-pathfinding.
The idea with three-pathfinding is that you create a navmesh matching the floor of your scene in a 3D editing tool like blender (which supports gltf by the way) and then loading that into your scene and passing it to three-pathfinding.
You then find out where on the navmesh you've clicked and pass that information to the lib and it will do the rest. The demo code has this method that you can use to find where in the scene you are clicking. Good luck on your adventure, hope this helped.
Tilestache doesn't serve polygons that are self crossed. like in the picture below.
I checked whether or not the polygon is stored within my postgresql, and it was the case. Therefore, the problem comes in serving, I kind of think that tilestache is not able to treat self crossed polygons. Any ideas ?
That is because a self crossing polygon is invalid in the OGC simple feature model. I can't think of a single program that will correctly display them.
I have a (actually quite simple) data structure that has a tree-like adjacency. I am trying to find a good way to represent data for a film-industry based web-app which needs to store data about film projects. The data consists of:
project -> scene -> shot -> version - each adjacent to the previous in a "one-to-many" fashion.
Right now I am thinking about a simple adjacency list, but I am having trouble believing that it would be sufficiently efficient to quickly retrieve the name of the project, given just the version, as I'd have to cycle through the other tables to get it. The (simplified) layout would be like this:
simple adjacency layout
I was thinking about - instead of referencing only the direct parent - referencing all higher level parents (like this), knowing that the hierarchy has a fixed depth. That way, I could use these shortcuts to get my information with only one query. But is this bad data modeling? Are there any other ways to do it?
It's not good data modelling from the perspective of normalisation. If you realise that you put the wrong scene in for a project, you then have to move it and everything down the hierarchy.
But... does efficiency matter to you? How much data are you talking about? How fast do you need a response? I'd say go with what you've got and if you need it faster, have something that regularly extracts the data to a cache.
Try a method called Modified Preorder Tree Traversal: http://www.sitepoint.com/hierarchical-data-database/
I am writing software for a device that would plot a 3D graph/line plot of where someone has traveled. This plotting will be during post-processing of the data, so real time is not a requirement.
My key problem is, I can't find suitable tools or even other CAD software (eg. Autocad) which will plot a line graph (I imagine it would plot it as a 'path'?) from a data file (eg. CSV) which I can then manipulate like a CAD model (ie. move it around, rotate it to view from different angles, etc).
There is a real-time aspect to it where my computer will connect to the device at regular intervals, pull current location data, and store it. The computer will run and communicate through a Windows Forms app but only at the end do I need to plot the graph.
Would you have any suggestions on how to go about this?
Thanks in advance
So much easier than I though it would be.
Basically, generate a new file named points.scr (this is an AutoCAD script file), that contains the following:
._LINE
0,0,0
1,2,4
2,2,4
C
Run this is AutoCAD by typing "scr" into the command prompt and selecting the points.scr file.
http://forums.autodesk.com/t5/AutoCAD-2004-2005-2006/script-to-draw-line/td-p/1219015