IRC log for #brlcad on 20130219

00:33.00 *** join/#brlcad velociostrich (~anonymous@24.0.153.224)
02:07.03 starseeker hmm. brlcad, does this look like something we might be able to leverage? http://embree.github.com/
02:12.18 *** join/#brlcad n_reed (~molto_cre@66-118-151-70.static.sagonet.net)
02:28.47 *** join/#brlcad kanzure (~kanzure@131.252.130.248)
05:29.20 *** join/#brlcad witness_ (uid10044@gateway/web/irccloud.com/x-laisyrdfbuutpilc)
05:43.48 *** join/#brlcad merzo (~merzo@95.133.167.155)
07:34.30 *** join/#brlcad Al_Da_Best (Al_Da_Best@cpc2-shep12-2-0-cust21.8-3.cable.virginmedia.com)
08:23.09 *** join/#brlcad merzo (~merzo@94.45.58.138)
09:00.37 *** join/#brlcad merzo (~merzo@94.45.58.138)
10:19.12 Notify 03BRL-CAD Wiki:Sschaffert * 0 /wiki/User:Sschaffer:
11:59.31 *** join/#brlcad merzo (~merzo@user-94-45-58-138-1.skif.com.ua)
12:13.26 ``Erik hm, http://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html
13:11.58 brlcad ``Erik: hah, now that's interesting
13:12.41 brlcad and something I didn't know about C99 ... not something I run into very often any more
13:55.53 ``Erik yeh, seems like it could be handy in some cases.... but I'm tempted to stick with c89, which I know like that back of my ha... wtf is that? O.o
14:00.26 starseeker as far as I know, the main reason we stick with c89 is Visual Studio
14:03.25 starseeker we might conceivably be able to do better if we could get all of our code to compile as C++ (which is much better supported in MSVC) but that's not a priority right now
14:07.07 ``Erik I was under the impression that msvc didn't do C at all, just C++ (thus the subset of C that is the intersection of C and C++)
14:50.55 *** join/#brlcad Skriptkid (~Skriptkid@117.202.107.184)
14:52.23 *** join/#brlcad merzo (~merzo@user-94-45-58-138-1.skif.com.ua)
15:00.19 *** join/#brlcad Yoshi47 (~jan@64.235.102.210)
15:05.38 *** join/#brlcad merzo (~merzo@user-94-45-58-138-1.skif.com.ua)
15:20.47 *** join/#brlcad Posterdati (~antani@host160-215-dynamic.11-87-r.retail.telecomitalia.it)
15:20.54 Posterdati hi
15:21.14 Posterdati please I need help on opennurbs code, could anyone help me? tx
15:22.08 Posterdati I'm trying to scale a .3dm geometry using ON_Xform and I'm trying to understand the explode_block_sample.cpp code
15:51.54 Notify 03BRL-CAD:d_rossberg * 54432 (rt^3/trunk/include/brlcad/globals.h rt^3/trunk/src/coreInterface/globals.cpp): experimental feature: activate semaphoresthis change has no impact on existing code
15:53.58 *** join/#brlcad Skriptkid (~Skriptkid@117.202.107.184)
16:48.06 *** join/#brlcad luca79 (~luca@adsl-ull-201-152.46-151.net24.it)
16:49.42 Posterdati hi
16:49.55 Posterdati is there any opennurbs expert?
16:52.29 archivist Posterdati, in IRC ask the real question not does anyone know x
16:53.46 Posterdati how to apply a transformation to a ONX_Model and save the result?
16:54.38 Posterdati I followed the explode_block_sample.cpp without success, it saves only the geometry objects at the end resulting in empty .3dm files
17:10.46 Posterdati :(
17:11.41 caen23 Posterdati: you shouldn't expect a prompt answer. stick around and wait for a reply
17:11.56 Posterdati sure
17:12.09 Posterdati anyway I was able to add new objects to the model
17:53.12 Notify 03BRL-CAD:bob1961 * 54433 (brlcad/trunk/src/tclscripts/archer/Archer.tcl brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl and 2 others): Refactored a bit of code related to the various edit panels. Also added code to clear data associated with highlighting the primitives being edited.
18:37.48 *** join/#brlcad brlcad (~sean@66-118-151-70.static.sagonet.net)
19:19.54 Notify 03BRL-CAD Wiki:Tmusselman * 0 /wiki/User:Tmusselman:
20:20.08 *** join/#brlcad merzo (~merzo@155-167-133-95.pool.ukrtel.net)
20:32.17 *** join/#brlcad ``Erik (~erik@pool-74-103-121-45.bltmmd.fios.verizon.net)
21:28.32 Posterdati hi
21:39.51 Notify 03BRL-CAD:carlmoore * 54434 brlcad/trunk/src/tclscripts/vmath.tcl: use DEG2RAD to simplify expressions; is the 'global' OK?
22:10.36 brlcad Posterdati: we strip the examples, so I'm not sure what that specific example refers to
22:11.02 brlcad what's the problem specifically? there should be a Transform() function that takes an ON_Xform
22:11.17 Posterdati thank you for helping me
22:11.52 Posterdati the problem is that I cannot get a valid pointer from ON_InstanceRef::Cast(...)
22:12.55 Posterdati how can I apply a transformation on objects in a ONX_Model objects and save it back on disk?
22:15.29 brlcad well, you apply it and then just call model.Write()
22:15.49 brlcad how to apply a transform depends on several factors, but Transform() is what you'll eventually call
22:15.58 brlcad probably on object(s) within the ONX_Model
22:16.57 Posterdati not using ON_Geometry class?
22:18.20 brlcad there's undoubtedly many ways
22:18.41 brlcad but the way I would expect is to iterate over the object(s) you want to transform, then write
22:18.56 brlcad something like
22:19.30 Posterdati yes
22:19.36 Posterdati but how to transform them?
22:19.53 Posterdati Transform is not applicable on ONX_Model objects
22:20.18 brlcad ONX_Model is a collection of objects
22:20.22 brlcad not an object itself
22:20.35 brlcad you have to iterate over them
22:20.50 Posterdati yes I know
22:21.02 Posterdati I iterate on m_object_table[ i ]
22:21.30 Posterdati but these ONX_Model_Object are not transformable
22:25.56 brlcad not directly, you need to get at the geometry they contain
22:26.13 brlcad it looks like you can transform via ON_3dmObjectAttributes
22:27.19 brlcad try m_attributes.Transform()
22:27.29 Posterdati ok
22:27.37 brlcad (on the onx_model_obj)
22:32.11 brlcad Posterdati: what are you doing with nurbs? how'd you come across brl-cad?
22:33.08 Posterdati no way, it didn't work
22:33.29 Posterdati I'm trying to write a simple program using opennurbs for .3dm reading and manipulation
22:33.56 Posterdati ON_Xform xform;
22:33.57 Posterdati <PROTECTED>
22:33.57 Posterdati <PROTECTED>
22:34.18 Posterdati this is the transformation
22:36.45 brlcad didn't work as in didn't do anything or didn't compile?
22:37.03 Posterdati compile, but object is not scaled along z axis
22:38.07 brlcad called Write() to a new file?
22:38.56 brlcad still, the way I'd expect it to work is as I mentioned before
22:39.20 brlcad i.e., you convert the onx_model_obj to real geometry, apply Transform()
22:39.25 Posterdati http://pastebin.com/H2frr5cm
22:40.46 brlcad what's pXModel?
22:40.56 brlcad you'd need to call something like sHeel.getModel().Write()
22:41.33 brlcad that style is whack :)
22:42.00 Posterdati to write
22:42.02 Posterdati but to scale?
22:42.12 brlcad you have to write what you scaled
22:42.27 Posterdati pGeometry?
22:42.38 Posterdati sorry
22:47.52 Posterdati http://pastebin.com/fq6qfiP1
22:48.27 Posterdati didn't work either the object is just copied from the other file :(
22:55.05 Posterdati :(
22:56.14 brlcad header says ON_Geometry::Transform() is for classes that derive from ON_Geometry, it's a hook
22:56.20 brlcad so that's not what you want
22:56.26 Posterdati ok
22:56.57 Posterdati but I did a cast
22:58.38 Posterdati damned mcneel
22:58.47 Posterdati :)
22:59.04 Posterdati this is the worst sdk I found
22:59.09 Posterdati until now
22:59.57 brlcad for free and open source, I kind of have the completely opposite impression
23:00.17 brlcad you have to read the sources sometimes, but it's all mostly straightforward
23:00.46 Posterdati I copied the example code and didn't work either
23:01.25 Posterdati explode_block_sample.cpp
23:01.29 brlcad note that they sell and provide support for rhinosdk too, it's got a lot more docs
23:01.46 Posterdati yes but I don't develop under windows
23:01.51 brlcad I haven't messed with that one
23:06.29 brlcad so I haven't tried this, but what I would expect to work is how we use it in other places
23:06.52 brlcad where you get ahold of the ON_Geometry and you cast to a real type
23:08.05 brlcad calling Transform() on the real geometry should do the work, and then that can be written
23:08.45 brlcad it's a few lines of code because you have to specifically cast to known types, but it's dead simple
23:09.08 brlcad there may be an easier way, but that would have been what I would have probably ended up with if I were trying that
23:09.16 brlcad I think we have an example somewhere
23:09.52 brlcad yeah, see main() in http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/conv/3dm/3dm-g.cpp
23:10.13 brlcad notably the line:
23:10.14 brlcad const ON_Geometry* pGeometry = ON_Geometry::Cast(model.m_object_table[i].m_object);
23:10.19 brlcad and then the block that follows
23:11.44 brlcad try just one known entity type like ON_Brep and see if it works
23:13.17 Posterdati I did so too, but compile complains about pGeometry -> MakeDeformable();
23:14.17 Posterdati should I save the ONX_Model after that?
23:14.29 brlcad not following
23:14.44 brlcad shouldn't need MakeDeformable() I think
23:14.49 Posterdati ok
23:15.11 Posterdati but pGeometry -> Transform(xform)
23:15.16 Posterdati doesn't compile
23:17.53 brlcad for (i=0; i<model.obj_table.Count(); i++) { ON_Geometry *g = ON_Geometry::Cast(model.obj_table[i].m_obj); if (g) { ON_Brep *brep = const_cast<ON_Brep * >(ON_Brep::Cast(g)); if (brep) brep.Transform(xform); } } ... model.Write();
23:18.07 brlcad that's expected
23:18.21 brlcad pGeometry is an ON_Geometry which is an opaque container
23:18.35 brlcad you have to cast it to "actual" geometry
23:18.56 Posterdati aah
23:19.09 Posterdati they are all breps
23:22.22 Posterdati didn't compile
23:22.28 Posterdati ON_Geometry *pGeometry = ON_Geometry::Cast(sObject.m_object);
23:22.57 Posterdati invalid conversion from const ON_Geometry* to ON_Geometry *
23:23.44 brlcad that doesn't look right
23:26.26 brlcad er, that's just a constness failure
23:26.33 brlcad const ON_Geometry ...
23:27.00 Posterdati ok, doesn't compile either
23:27.41 Posterdati request for member 'MemoryRelocate' in ...
23:28.16 brlcad I can't debug it for you :)
23:28.30 brlcad we use this exact method I mentioned in the link I showed
23:28.44 brlcad you have to sync up the types
23:28.54 brlcad we toss the const later
23:29.15 brlcad but there are several ways
23:30.10 Posterdati is the ::Cast a must?
23:30.22 brlcad the basic idea though is to iterate over the objects in the model, get each object's geometry container, cast each geometry container to the real thing, transform, and then write it out
23:30.47 Posterdati writing the parent ONX_Model ?
23:31.28 brlcad that bit I don't recall, but at the time you have done the transform, shouldn't matter -- you either will be able to write it or write each real thing
23:31.48 brlcad I'd expect the parent to work
23:32.01 Posterdati ok tx
23:32.07 brlcad but i haven't read the header to know if that's kosher
23:32.32 brlcad in our example, we write out to a new file, so it's moot
23:33.14 Posterdati me too
23:33.38 Posterdati well it's an object transformed
23:33.43 brlcad I mean we write out our ON_Brep to a new file (and not a .3dm)
23:34.16 brlcad but we write the ON_Brep, not the parent model or object or geometry
23:34.25 Posterdati ah ok
23:34.26 brlcad so at least that works ;)
23:34.43 brlcad and I would expect writing the model to work, but lot of variables there
23:34.51 brlcad you know
23:35.02 Posterdati so a brep could be transformed regardless an ON_Geometry object
23:35.03 brlcad did you end up inadvertently creating a copy anywhere along the line, etc
23:35.12 brlcad sure
23:35.17 Posterdati so
23:35.32 Posterdati why use ON_Geometry? My objects are all breps
23:35.33 brlcad and looking at the code, ON_Brep does override ON_Geometry::Transform() with the actual logic
23:35.42 brlcad you shouldn't be
23:35.58 brlcad you just go through that container in the process of iterating
23:36.23 Posterdati may I cast .m_object directly to brep?
23:36.29 brlcad beats me ;)
23:36.33 brlcad mebbie
23:36.47 brlcad Cast() is a low-level ON_Object feature, so probably
23:36.57 Posterdati I'm trying right now
23:36.58 brlcad we make sure it's geometry though "just in case"
23:37.14 brlcad the whole system is based around uuid registration, so it should work
23:38.18 Posterdati request for member 'MemoryRelocate' in ...
23:38.22 Posterdati what the Hell is this???
23:41.25 brlcad sounds like you're doing something wrong ;)
23:42.15 Posterdati yes like using opennurbs
23:43.01 brlcad what's your code look like?
23:43.51 brlcad they have a forum, there may be a simple solution to what you're trying to do and they do provide pretty good free support for relatively simple questions like this
23:44.05 brlcad did you follow our example?
23:44.34 brlcad it's pretty much a recipe that should work as-is
23:47.29 Posterdati is compiling now!
23:47.35 Posterdati testing
23:48.55 Posterdati WORKS WORKS WORKS !!!!
23:48.56 Posterdati tx
23:49.06 Posterdati you saved me man
23:49.10 Posterdati thanks a lot
23:49.22 Posterdati I wrote the ONX_Model parent object
23:58.19 brlcad cool

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.