cudarsjanis Posted January 30, 2020 Share Posted January 30, 2020 Hi Any chance you guys know how could rotate the card to match 2 vectors I have specified? (@N and @up) Cheers Janis alignToVector.hip Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted January 30, 2020 Share Posted January 30, 2020 Hi, one way might be using the sample covariance matrix of the geometry points and calculate the eigenvectors. These vectors can be used to align the geometry along x,y,z. alignToVector.hipnc 1 Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted January 30, 2020 Author Share Posted January 30, 2020 55 minutes ago, Aizatulin said: Hi, one way might be using the sample covariance matrix of the geometry points and calculate the eigenvectors. These vectors can be used to align the geometry along x,y,z. alignToVector.hipnc Hey, Thanks for the reply! Really appreciate it. For now looking at it, if looks way over my head in vex and python. So I don`t really know how to transform it back to original orientation. Also it doesn`t work when scaled down. and when I rotate the original card if flips from one side to another. Just t clarify what I`m after. Im gonna have multiple cards around geo that I want to rotate and scale if for each loop. So my idea was to bring each card to origin align with XY axis then just use transform for scale and rotation, and then apply transforms back to card to get it back to original position and rotation(with new roation ac scale on top of those transforms). Similar to this effect. just want to have control on scale and rotations based on normals from geo. Cheers Janis Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted January 30, 2020 Author Share Posted January 30, 2020 For now I use this setup. (for each is because I`m applying it to many cards) But rotation doesn work if original card is facing different directions unfortunately alignToVector2.hipnc Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted January 31, 2020 Share Posted January 31, 2020 Hi, here is another version. In the first version I've used @P -= Center again, which was wrong. It has to be += and if you want the geometry to copy to another geometry this center should be the root. It is better, that this root is zero vector. There is another problem. The geometry is flipping, if you change the orientation. I will take a look at it later. alignToVector2.hipnc 1 Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted January 31, 2020 Share Posted January 31, 2020 (edited) Heres an example of how you can set it up. mystique_01.hip Edited January 31, 2020 by ThomasPara Changed the file 2 Quote Link to comment Share on other sites More sharing options...
Yader Posted January 31, 2020 Share Posted January 31, 2020 (edited) And here's another example, utilizing existing sop nodes instead of custom VEX Disable the Channel SOP for tweaking, as recalculating the delay effect takes its computational toll... Feather_Mystique_01.hiplc Edited January 31, 2020 by Yader 1 Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted January 31, 2020 Author Share Posted January 31, 2020 10 hours ago, Aizatulin said: Hi, here is another version. In the first version I've used @P -= Center again, which was wrong. It has to be += and if you want the geometry to copy to another geometry this center should be the root. It is better, that this root is zero vector. There is another problem. The geometry is flipping, if you change the orientation. I will take a look at it later. alignToVector2.hipnc Thanks. this works nicely(apart from flipping) Just not sure how to do rotation and scaling and then transform card to original position. Thanks for the help! Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted January 31, 2020 Author Share Posted January 31, 2020 3 hours ago, Yader said: And here's another example, utilizing existing sop nodes instead of custom VEX Disable the Channel SOP for tweaking, as recalculating the delay effect takes its computational toll... Feather_Mystique_01.hiplc These new nodes in H18 are gold! Orientation along curve!. shame can`t use 18 for this project. So doing this vex . Cheers Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted January 31, 2020 Author Share Posted January 31, 2020 6 hours ago, ThomasPara said: Heres an example of how you can set it up. mystique_01.hip Thanks a lot. will look into this. Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted January 31, 2020 Share Posted January 31, 2020 Here is fixed version, where all orientation nodes are wrapped together into one node. The only input is a base(root) point parameter, which has to be defined. The flippings problem seems to be solved now. It looks like, that copy to points works with it. cov_eigenB.hipnc 1 Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted January 31, 2020 Author Share Posted January 31, 2020 59 minutes ago, Aizatulin said: Here is fixed version, where all orientation nodes are wrapped together into one node. The only input is a base(root) point parameter, which has to be defined. The flippings problem seems to be solved now. It looks like, that copy to points works with it. cov_eigenB.hipnc Dude you`re a legend! Thanks a lot for this. It`s gonna take some time for me to go through all the wrangles and understand how exactly it`s working But it works good. apart from cards flipping. I`ll upload part of my setup so it`s more clear what I`m doing. I kinda made it work with building a polyframe and rotating, This tutorial helped me a lot with trying to understand matrices and so on: but it rotation work only on one axis and when I try scaling it acts bit funky (RotX and scaleY works nice). That is why I thought bringing it to center. do all the rotations and transforms there and then transform it back to world space(for each card) would be a better solution. Cheers Janis cov_eigenC.hipnc Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted January 31, 2020 Share Posted January 31, 2020 Same setup with your feathers, and with uniform scale. Mystique_02.hipnc 2 Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted February 1, 2020 Share Posted February 1, 2020 (edited) The flipping problem was due numerical inaccuracy. The problem is to get 4 points which are not in a plane. If the points are too close together following calculations may fail. Once you are sure you have 4 points (with pt id), which are not in plane you can use them to avoid the flipping problem. But anyway - I think for your problem this is not the best solution, because it is very time consuming. I like Thomas solution, because he is using the information of the surface to get the orientation and using point wrangle, which is quite fast. If you have no other Information about Orientation this may be the only option or perhaps there are better solutions. Just for completeness here is another file. I've changed a bit: there is an input for eps (accuracy) too small or too big values will not work the node outputs the transformation matrices for backtransformations I've added an example bend node with custom parameters based on foreach values and distance functions Generally foreach offers more flexibility than parallel point wrangle or hard coded nodes, but in many cases it has less performance. P.S. just as a quick and dirty method: to incease the performance you can also loop once over the geometry and save all necessary attributes into detail arrays referencing to each class. Using these attributes you can transform each point (which shoud have a unique class) to X,Y,Z, perform your operations and transform it back. Here is another modified example ("cov_eigenE")(which will probably not work for every situation just more to visualize what I mean). cov_eigenD.hipnc cov_eigenE.hipnc Edited February 1, 2020 by Aizatulin 1 Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted February 1, 2020 Share Posted February 1, 2020 In general i avoid "for-each" networks, it usualy becomes to slow. And when things get slow, art directing and creativity get worse. You can make hda's of your vex setups and then it gets as easy to use as a node. You can get a long way with learning how to use vectors, matrixes and quaternions. 2 1 Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted February 1, 2020 Share Posted February 1, 2020 Yes I agree, but using quaternions will have true benefit in performance if you chaining (many) rotations. Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted February 4, 2020 Author Share Posted February 4, 2020 Thanks for all the help guys. Lots of files and setups to learn from. I ended up just getting rot axis Vector(using N and up vector) and getting orient attribute with quaternion function. As this seems like the easiest way to rotate. I bring each card to the center so I use transform just to scale them up uniformly. Cheers Janis 1 Quote Link to comment Share on other sites More sharing options...
vinyvince Posted August 13, 2021 Share Posted August 13, 2021 (edited) For some of my personal work, i will like to be able to rotate, some piece along their most suitable candidate edge, and for this using some curve generate by shortest path like here or maybe gradient field. i guess i will have to simplify the edge also off course to get some kind of median axis. tIm not familiar with eigen, covariant matrice , probably i guess i have to use dot product once i make an approximation of the main edge of every piece and compare the normal or each to the tangent of the closest path or so... Any TD around which might feel more comfortable here with the maths and don't mind to give a try this puzzle challenge? Anyone please ? Hip attached @Aizatulin @ThomasPara @f1480187 piece_to_orient_curveguide.hip piece_to_orient_curveguide.hip @konstantin magnus@petz@k2p8 Edited August 14, 2021 by vinyvince Quote Link to comment Share on other sites More sharing options...
Librarian Posted August 15, 2021 Share Posted August 15, 2021 "White Dog" on Twitter have file Curve skeleton , some tricks inside Maybe gonna Help if you not already found That @vinyvince Quote Link to comment Share on other sites More sharing options...
vinyvince Posted August 15, 2021 Share Posted August 15, 2021 (edited) It is now possible to do mystic effect with Hair comb tool Edited May 18, 2022 by vinyvince Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.