Closed sriramab closed 8 years ago
If your agents use the moving
skill, and if your only concern is to visualize their direction, you can easily display that using the end_arrow
facet of the draw
statement.
For instance:
aspect x {
if (destination != nil) {
draw line([location, destination]) end_arrow: 2 color: #blue;
}
}
or if you want to have the same length, let's say 5:
aspect x {
draw line([location, {location.x + 5 * cos(heading), location.y + 5 * sin(heading)}]) end_arrow: 2 color: #blue;
}
Pretty much solves your issue, doesn't it ?
Hmm, Yes it does - although not precisely placed at the right location. Not completely out of context, but I have this small question. I see many nice aspects in models library. Do you think it is possible (enhancement)
arrow
, it inserts an aspect into the code. It is just like choosing symbols for point objects in many GIS software.aspect movingMen { draw myAspectLibrary::aspect("men") } //where myAspectLibrary is myAspectLibrary.gaml
I will try your suggestions and close the issue in a couple of days.
Hi, aspects are tightly linked to the species that define them (since you can use their attributes, even actions in them). So there would be no point in allowing to "grab" an aspect from another species, unless, of course, you inherit from it, in which case you can reuse it directly.
One enhancement about this could be to allow skills to define aspects (for example, having some aspects in the moving skill with arrows, etc.). But I'm not sure about its usefulness for other skills.
BTW, did the aspect proposed above solve your problem ?
Yes, your solution solved my arrow issue though the arrow does not sit right at the agent location, but I am happy with it.
For the discussion on aspects, I mean, just like a dropdown menu for user to choose a shape just like one is able to choose colors right now . After digging a bit I feel this is similar to gama-platform/gama2#6
My idea was to have like an external text file which has various aspects (trees, houses, human, bird, arrow, car etc). The dropdown menu can read this txt file, may be the name of the aspect, and when selected will insert the aspect at cursor position.
If later I develop a nice looking truck shape, I can append this txt file and an aspect titled truck appears on the menu. User can just select and the portion of aspect is inserted into the code.
Users can then of course add simulation parameters-variables and modify dimension as it suits their need.
OK. Can you open a separate request for enhancement on this ? It might be a good subject for a student internship, for example !
Hi,
Most of the shapes in GAMA are regular symmetric shapes (circle,square, triangle or the 3d ones). With these, it is difficult to see their
heading
, example the direction the agent is facing/pointing. I would like to request one or two shapes that are (can be) pointed in the direction of their heading.May be an isosceles triangle?, extending the triangle to take 2 arguments, (base_side_length, angle_at_the_base_to_equal_sides)
May be an arrow shape that takes height as argument- arrow(height)