Dealing with matrices Author Message
Zervox Silver Supporter Post: #1 Dealing with matrices Anyone here have good experience with matrices that could help me on this? Trying to convert EE matrix for use in a third party library and I am not sure I am assigning the correct variables to the correct spots in the arrays. Also anyone know of a function to get ProjectionView matrix from Esenthel? or do I have to write my own hacky way of getting it? Code: ```/*//Guideline Projection //m = projection.M11; m = projection.M12; m = projection.M13; m = projection.M14; //m = projection.M21; m = projection.M22; m = projection.M23; m = projection.M24; //m = projection.M31; m = projection.M32; m = projection.M33; m = projection.M34; //m = projection.M41; m = projection.M42; m = projection.M43; m = projection.M44; */``` Code: ```Dbl arr; arr = projview.x.x; arr = projview.y.x; arr = projview.z.x; arr = projview.pos.x; arr = projview.x.y; arr = projview.y.y; arr = projview.z.y; arr = projview.pos.y; arr = projview.x.z; arr = projview.y.z; arr = projview.z.z; arr = projview.pos.z; arr = projview.x.w; arr = projview.y.w; arr = projview.z.w; arr = projview.pos.w;``` //\param p A pointer to 16 doubles representing a 4x4 projection matrix. //void SetProjectionMatrix(const double *p); environment->SetProjectionMatrix((Dbl*)&arr); Matrix4 view = Cam.matrix; Code: ```arr = view.x.x; arr = view.y.x; arr = view.z.x; arr = arr = view.x.y; arr = view.y.y; arr = view.z.y; arr = 0; arr = view.z.x; arr = view.z.y; arr = view.z.z; arr = 0; arr = view.pos.x; arr = view.pos.y; arr = view.pos.z; arr = 1;``` //param m A pointer to 16 doubles representing a 4x4 modelview matrix. //void SetCameraMatrix(const double *m); environment->SetCameraMatrix((Dbl*)&arr);
05-17-2015 10:25 PM
Esenthel Post: #2 RE: Dealing with matrices If you want to use a 4x4 matrix, then you can first convert EE Matrix to EE Matrix4 Matrix m; Matrix4 m4=m; then you can try 2 attempts: Flt *f=(Flt*)&m4; external_lib_matrix4[x + y*4]=m[x + y*4] or external_lib_matrix4[x + y*4]=m[y + x*4]
05-17-2015 11:33 PM
Zervox Silver Supporter Post: #3 RE: Dealing with matrices Ok, so apparently I need to get ModelViewMatrix, how is the procedure for this? Edit: I found a way to work around it although it looks like I needed to use my source access for it. objectmatrix*inversecamera(without having to inverse the matrix additionally myself that is). (This post was last modified: 05-18-2015 07:04 AM by Zervox.)
05-18-2015 02:31 AM
Esenthel
{"ft_lang_label":"__label__en","ft_lang_prob":0.70806515,"math_prob":0.93200034,"size":1808,"snap":"2019-51-2020-05","text_gpt3_token_len":627,"char_repetition_ratio":0.3037694,"word_repetition_ratio":0.031620555,"special_character_ratio":0.38440266,"punctuation_ratio":0.28601694,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9914619,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-10T21:39:52Z\",\"WARC-Record-ID\":\"<urn:uuid:dcdcbb5f-ad8c-4167-80ee-5497af76970e>\",\"Content-Length\":\"23604\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f64356ed-7e1e-4bd2-addd-c222a87b4979>\",\"WARC-Concurrent-To\":\"<urn:uuid:deddc90b-85d3-4fb7-9db5-46ef47e115a8>\",\"WARC-IP-Address\":\"174.142.230.146\",\"WARC-Target-URI\":\"https://esenthel.com/forum/showthread.php?tid=8503&pid=51740\",\"WARC-Payload-Digest\":\"sha1:BVYL77NAGGJFQGFVFUL6SD2UICBLETTK\",\"WARC-Block-Digest\":\"sha1:AHRVMNP34EJWYGENCL6TSNDMX5JVBXKT\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540529006.88_warc_CC-MAIN-20191210205200-20191210233200-00115.warc.gz\"}"}