Repast Simphony Projection customisation - projection

I read in a book that a projection in Repast Simphony can be any user implementation of the Projection interface. I would like to create a custom projection but it looks more complicated that I expected.
Have any of you ever tried to create their own projection? If so, would it be possible for you to explain how to proceed please? Thank you.

I think creating the Projection implementation should be fairly straightforward. However, it will not be integrated with the visualization architecture. So, your agents will be able to participate in the Projection but it will not be visualized.
If you implement a Class with the Projection interface and the ContextListener interface that should be enough. You can use the DefaultProjection as a starting point. Most, if not all, of the standard Projection hierarchies use the DefaultProjection as a starting point and their subclasses implement ContextListener. See AbstractGrid and ContextGrid, for example. The source should be useful as guide to implementation.

Related

Is there any point in drawing an UML class diagram in functional programming?

I have been asked on a school project to show the UML diagrams I used - if I did -
to realise the project. But the project I was working on was in C and has been functionally programmed.
Thus I want to justify that using a class diagram when not using object oriented langage was pointless, but I am afraid that this is not true and haven't been able to confirm this hypothesis. It seems pointless to me but I'd like to know if it is the case, since may be thinking the code in a OOP way could help understanding how it works.
Is there any benefits regarding the way to think and build a functionnal program in using a class diagram ?
Of course, yes. The use of class diagram is not so extensive as in classical OOP, where very often having a class diagram means only automatic coding routine is left, but still it is very useful for:
Planning of data structures (We still should understand data and their interconnections)
Creating the hierarchy of methods. (Grouping of methods up to their data and tasks)
Tying together methods and some special data. (What method works with what classes of data)
If the language supports OOP, you can use a class diagram translating it into code.
And even if you haven't any OOP features supported, you can always profit from at least the first point.
Really, the only possible use of the class diagram, that is forbidden by functional programming, is creation of methods with side effects on instances. And that is not much connected to the class diagrams. On the contrary, class diagrams are not mentioned for modelling of that. Rather the Composite Structure Diagrams are.
There is a point in creating a diagram.
Think of a struct as a class.
A struct maybe contains other structs.
So you have a relation from one type to another. With UML you can model the relationships of your structs and this is really helpful in larger projects.
If you dedicate a file.c to a struct you could think of a real class, if every function of the file.c takes an instance of the struct as parameter.
If you are going to document FP with OO you will deviate your FP to OO. That might not be the worst, but definitely class diagrams in FP are pointless.
However, UML has more to offer than class diagrams. You will definitely benefit from state diagrams. Eventually from timing diagrams. And in a limited sense from sequence diagrams. The latter would only make sense if you can show "information tokens" equivalent to messages used in SDs.
Finally a higher level picture could be sketched using activity diagrams.

Is it possible to programatically create a simple 3d object on Unreal?

Is there a way to create and use a simple 3d model on the Unreal Engine?
Your best bet would be to create the initial 3D asset in a third party tool and import it into the IDE. From there you can change the texture map, and manipulate the aesthetics in one way or another, but the initial 3D model should be in an external 3D format, and then placed as a prefab into your world.
Creating an object dynamically in UDK is cumbersome and requires lots of tweaking, and won't save much in terms of cost of resources. Especially if you want it to look good and more than just 3D meshes thrown together rudimentarily. It is possible, but almost not worth it, especially if you have 3DSMax, Maya, Cinema4D, MotionBuilder, or one of the other hundred tools available to do the grunt work for you.
Most 3D Engines (IE Unity, UDK, Torque, Cry and now Havok) support many formats, and especially the unversal FBX. You could even use google sketchup and export to DAE or FBX format to get it into your Engine. Grant it you lose a lot of the elements, but the basic 3D mesh stays relatively in tact.

PCL cube detection

I want to use PCL(point cloud library) to implement cube or rectangle detection for any size in a scene.
Can anyone give me some direction?
You may want to take a look at this PCL tutorial or, in general, at all the techniques implemented in the pcl::recognition module.
On the PCL users mailing list archive (here), there is an older but yet useful discussion about simple object recognition. For simple objects, as in your case, you may consider using Sample Consensus for segmenting the model inside your scene point cloud.

Implementing boundary representation modeling

Does anyone have any good implementation strategies or resources for putting together a b-rep modeling system?
OpenCascade is an apparently good library for b-rep modeling (used by FreeCad and PythonOCC are both very cool) but the library is huge, complicated and may not be a good starting point to learn about b-rep modeling 'engines'.
I've done quite a bit of research paper reading, and while the fundamental math is useful for understanding why everything works, its left me with some implementation questions.
The halfedge data-structure seems to be the preferred way to store information about a body in b-rep implementations.
So a handful of questions in no particular order:
Using the halfedge data-structure how is rendering typically implemented? Triangulation based on the solid's boundaries?
How are circular faces/curved surfaces typically implemented? For instance a cylinder in one basic introduction to b-rep's I read, was internally stored as a prism. IE an extruded triangle and meta-data was stored about the cap faces denoting that they were indeed circular.
How are boolean operations typically implemented? I've read about generating BSP-Tree's along the intersection curves then combining those tree's to generate the new geometry. Are there other ways to implement boolean operations and what sort of pro's/con's do they have?
Thanks!
If you'd like to provide a code example don't worry about the language -- the questions are more about algorithmic/data-structure implementation details
I'm working on a B-Rep modeler in C# (I'm in a very early stage: it's an huge project) so I ask myself the same questions as you. Here is my answers:
Triangulation: I've not done this step, but the strategy I'm thinking about is as follow: project the face boundaries in parameter space to obtain 2D polygons (with holes), triangulate that with the ear clipping algorithm and then reproject triangle vertices in 3D space. For curved surfaces, I need to split the polygons with a grid in order to follow the surface;
For a cylinder, there is 3 edges : two circulars and one line segment. I have classes for each type of curves (Segment3d, Circle3d...) and each half-edge hold an instance of one of theses classes. Each face hold an instance of a surface object (plane, cylinder, sphere...);
There is an interesting project here based on BSP-Tree, but it uses CSG method, not B-rep. I'm still researching how to do this, but I don't think I will need a BSP tree. The difficulty is in computing intersections and topology.
The best books I've found on this subject:
3D CAD - Principles and Applications (old but still relevant)
Geometric Modeling: The mathematics of shapes (more recent than the previous one, but less clear)

Is there a matrix math library that is good to use alongside OpenGL to keep track of primitive co-ordinates for collision detection

Matrix math library that is good to use alongside OpenGL to keep track of primitive co-ordinates.
Does such a thing exist? Is this the best way to track my objects for use in collision detection?
You don't describe your situation very much but I'm assuming that you are making some game or simulation application?
I would suggest you use a physics engine, like Bullet or ODE, from the start. This way you will get a properly optimized matrix library plus well tested collision detection and handling. Using some other general-purpose matrix math library may seem easier at first glance. However it will probably be less adapted to your needs and will surely be a mess to replace with a physics engine if you decide to use one later on.
You don't have to use all the fancy features of the physics engine right away. In fact you could very well just use the matrix and vector implementation and skip the rest until later.
OpenGL is simply for rendering the objects from your data store, your physics/collision library will already have matrices for all the objects within it.
I dont think there is such thing. Maybe this helps to clarify a few things:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=30

Resources