diff --git a/260424-GrayScale.toe b/260424-GrayScale.toe index 8e516b8..08286b6 100644 Binary files a/260424-GrayScale.toe and b/260424-GrayScale.toe differ diff --git a/camera_position.py b/camera_position.py index 3a5b18c..0c4758d 100644 --- a/camera_position.py +++ b/camera_position.py @@ -4,81 +4,132 @@ me - this DAT scriptOp - the OP which is cooking """ +import math + def onCook(scriptOp): """ Called when the Script DAT needs to cook. """ scriptOp.clear() - scriptOp.appendRow(['id', 'P(X)', 'P(Y)', 'P(Z)']) + scriptOp.appendRow(['id', 'P(X)', 'P(Y)', 'P(Z)', 'Rot(x)', 'Rot(y)', 'Rot(z)']) - # Find the constant OP relative to this script - const_op = op('constant1') + # 1. Fetch Constants + const_op = op('constant_camera') camera_y_offset = 0 - camera_y_far=0 + camera_y_far = 0 + + # Default rotation and timing values + rx, ry, rz = 0.0, 0.0, 0.0 + duration_per_step = 3.0 + if const_op: + # Distance Offsets target_chan = const_op.chan('camera_distance_y') if target_chan is not None: camera_y_offset = target_chan.eval() - camera_y_far = const_op.chan('camera_distance_y_far').eval() - + + far_chan = const_op.chan('camera_distance_y_far') + if far_chan is not None: + camera_y_far = far_chan.eval() + + # Rotation Values + rx_chan = const_op.chan('rot_x') + ry_chan = const_op.chan('rot_y') + rz_chan = const_op.chan('rot_z') + if rx_chan is not None: rx = rx_chan.eval() + if ry_chan is not None: ry = ry_chan.eval() + if rz_chan is not None: rz = rz_chan.eval() + + # Duration / Speed + dur_chan = const_op.chan('duration_per_seconds') + if dur_chan is not None: + duration_per_step = max(0.1, dur_chan.eval()) # Prevent division by zero - const_select=op('SelectId') - select_id=-1 + # 2. Check for specific ID selection + const_select = op('SelectId') + select_id = -1 if const_select: select_chan = const_select.chan('id') if select_chan is not None: select_id = int(select_chan.eval()) - - - # Check if there is an input connected + # 3. Input Validation if len(scriptOp.inputs) == 0: return inputDat = scriptOp.inputs[0] + # CASE A: Tracking a specific single ID if select_id >= 0: - # Find the row with the matching ID in the input table - for i in range(1, inputDat.numRows): + # Ensure the target CHOP exists + target_path = 'grid_text' + str(select_id + 1) + '/OUT' + out = op(target_path) + + if out: try: - row_id = int(inputDat[i, 0]) - if row_id == select_id: - px_val = float(inputDat[i, 1] or 0) - py_val = float(inputDat[i, 2] or 0) - pz_val = float(inputDat[i, 3] or 0)- camera_y_offset - scriptOp.appendRow([row_id, px_val, py_val, pz_val]) - return - except (ValueError, TypeError): - continue + px_val = out['px'].eval() + py_val = out['py'].eval() + pz_val = out['pz'].eval() - camera_y_offset + scriptOp.appendRow([select_id, px_val, py_val, pz_val, rx, ry, rz]) + except: + # Handle cases where channels might be missing + pass return + + # CASE B: Panning sequence (Average -> P1 -> P2 -> P3 -> P4) else: - # append with average of rows 1 to 4 (index 1 to 4 inclusive if they exist) - ax = 0.0 - ay = 0.0 - az = 0.0 - rows_processed = 0 - # Process rows 1 to 4 (index 1 to 4 inclusive if they exist) + raw_points = [] + sum_x, sum_y, sum_z = 0.0, 0.0, 0.0 + + # Gather up to 4 points from the input table for i in range(1, min(5, inputDat.numRows)): try: - # Safely convert cell values to floats - # Assuming col 1=X, 2=Y, 3=Z based on your previous logic - px_val = float(inputDat[i, 1] or 0) - py_val = float(inputDat[i, 2] or 0) - pz_val = float(inputDat[i, 3] or 0) - - ax += px_val - ay += py_val - az += pz_val - - rows_processed += 1 + px = float(inputDat[i, 1] or 0) + py = float(inputDat[i, 2] or 0) + pz = float(inputDat[i, 3] or 0) + raw_points.append((px, py, pz)) + sum_x += px + sum_y += py + sum_z += pz except (ValueError, TypeError): - # Skip rows that don't contain valid numbers continue - if rows_processed > 0: - ax /= rows_processed - ay /= rows_processed - az /= rows_processed - scriptOp.appendRow(['average', ax, ay - camera_y_far, az]) + + if not raw_points: + return + + # Calculate Average Position + num_raw = len(raw_points) + avg_pos = (sum_x / num_raw, sum_y / num_raw, sum_z / num_raw) + + # Build the sequence: [Average, P1, P2, P3, P4] + sequence = [avg_pos] + raw_points + num_steps = len(sequence) + + if num_steps == 1: + p = sequence[0] + scriptOp.appendRow(['average_only', p[0], p[1], p[2] - camera_y_far, rx, ry, rz]) + else: + total_time = absTime.seconds + + # Calculate current segment and interpolation factor + progress = (total_time / duration_per_step) % num_steps + idx1 = int(progress) + idx2 = (idx1 + 1) % num_steps + alpha = progress - idx1 + + # Smooth transition (Cosine ease) + alpha = (1 - math.cos(alpha * math.pi)) / 2 + + # Perform Linear Interpolation + p1 = sequence[idx1] + p2 = sequence[idx2] + + ax = p1[0] + (p2[0] - p1[0]) * alpha + ay = p1[1] + (p2[1] - p1[1]) * alpha + az = p1[2] + (p2[2] - p1[2]) * alpha + + label = "avg" if (idx2 == 0) else str(idx2) + scriptOp.appendRow([label, ax, ay, az - camera_y_far, rx, ry, rz]) return diff --git a/dat_table_json__td_7768_7.tsv b/dat_table_json__td_7768_7.tsv index 665dade..3c34200 100644 --- a/dat_table_json__td_7768_7.tsv +++ b/dat_table_json__td_7768_7.tsv @@ -1,51 +1,51 @@ text group center_x center_y center_z axis_x axis_y axis_z radius info -公司給你自由不代表你可以隨心所欲 3 0 -0.07553135634786745 0 0 1 0 1.239557785295072 //2025/08/07 15:31/187 likes/2 replies -留言自己看 3 0 0.9134948858144512 0 0 1 0 2.337996456309985 //2026/01/02 16:44 -要寫明確的主詞 3 0 0.7425403470776581 0 0 1 0 2.3050363960786044 //2026/01/02 15:34/329 likes/4 replies -修煉還不夠🥲 3 0 -0.6001895967914734 0 0 1 0 1.021857430934283 //2025/05/14 18:25/1 likes/1 replies -哈,那穿柯p 無罪 3 0 -0.43695701467883286 0 0 1 0 2.257577958365973 /undefined likes/undefined replies -要跳脫制約與束縛不容易 3 0 -1.2985959067002266 0 0 1 0 1.5030187414222889 /undefined likes/undefined replies -庇護力矩 3 0 -1.4478624155152398 0 0 1 0 2.0896923021492517 /undefined likes/undefined replies -願意花自己的錢保護 3 0 -0.7751398057893999 0 0 1 0 1.4818809334570155 //2024/06/18 01:26/816 likes -需要的溫柔是能覺察並關照他人 1 0 -0.9987873379716712 0 0 1 0 1.7309131228210144 /undefined likes/undefined replies -你只會被利用 0 0 0.33450930084977326 0 0 1 0 1.9989462012621688 //2025/12/06 17:42 -牛比轟轟 2 0 -0.4060401885538951 0 0 1 0 1.902990091366467 //2025/05/17 23:48/2 likes -推,立馬追蹤 0 0 -0.04977216069791002 0 0 1 0 1.9673107290184693 //2026/01/02 09:16/1 likes/1 replies -樓主正氣! 0 0 -1.1988494628661952 0 0 1 0 2.4012255150963546 //2025/12/28 16:16/4 likes -測試奴性,不是抗壓性 1 0 2.1539203321495695 0 0 1 0 2.1709531258319354 /undefined likes/undefined replies -+1 2 0 0.44933671224595706 0 0 1 0 2.21415755472181 /undefined likes/undefined replies -留言區好乾淨 2 0 1.0870615258897898 0 0 1 0 2.557391190845445 /undefined likes/undefined replies -幫忙檢舉 0 0 -0.7218779113724709 0 0 1 0 1.5975307753704104 //2025/12/28 11:06/2 likes -蛤? 2 0 -0.07431219116335797 0 0 1 0 2.037819906251535 //2025/05/17 22:41/1.8 萬 likes/65 replies -拜託錄取我吧!! 2 0 -0.26533454871526363 0 0 1 0 2.1424218799906094 //2025/05/18 18:30/113 likes -這讓我們有個防範心理。 1 0 -0.6985487920151945 0 0 1 0 1.43893212048234 /undefined likes/undefined replies -信仰是給你自由 2 0 -0.3581077680434763 0 0 1 0 0.8606014423948584 //2025/03/28 21:36/1 likes -努力脫離社畜人生 2 0 0.2619674642750027 0 0 1 0 0.6639580692799215 //2025/03/15 13:01/1 likes/1 replies -有多自律就多自由 2 0 -0.1446167710071924 0 0 1 0 0.593196311640623 //2025/04/22 20:08 -看透社會運作本質 2 0 1.4871357803516512 0 0 1 0 3.4162988890981443 //2025/07/25 23:25 -负重前行有人替你 0 0 0.4704794129945089 0 0 1 0 1.6607164319482652 //2025/09/08 21:39/2 likes -不要來鬧事。 1 0 1.0559061365412115 0 0 1 0 1.1044376257416193 //2025/06/26 02:26 -休假也打 2 0 1.9568816096895123 0 0 1 0 3.637549676459415 //2024/10/14 02:38/24 likes/2 replies -學他們的做法 1 0 2.120506627037294 0 0 1 0 2.1595443519582345 //2025/09/24 23:21 -現場主管滿頭問號 1 0 1.828231964844191 0 0 1 0 1.8962230013603028 /undefined likes/undefined replies -我是熱舞社的 2 0 -0.18029984355678863 0 0 1 0 2.297455423400649 //2025/05/18 15:27/24 likes/1 replies -有時間安穩度日 2 0 0.35075123945430686 0 0 1 0 0.3940601302284948 //2025/03/14 22:37/1 replies -沒遲到過 1 0 0.5707191241047793 0 0 1 0 0.638295471338136 //2026/01/07 21:21 -我ig有詳細紀錄 2 0 0.509988989289794 0 0 1 0 0.6643608356642301 //2025/03/15 13:30 -開介紹卡之前 1 0 -0.46741080504700694 0 0 1 0 2.214063202388144 //2025/09/12 08:19/1 likes/1 replies -鎖留言我回不了喔 0 0 0.2894521026803467 0 0 1 0 0.7263989716056127 //2025/10/31 16:52/2 likes -你覺得合理嗎?貼文的 0 0 -1.3835955784039289 0 0 1 0 2.3376279639597173 //2025/09/10 10:04 -這是豪豬😍 3 0 -0.09354206576515622 0 0 1 0 0.6884663321976022 /undefined likes/undefined replies -留言區好乾淨 2 0 1.5415117404669125 0 0 1 0 2.952375276266454 /undefined likes/undefined replies -有限的福利裡給予精神支持 1 0 1.761583239348294 0 0 1 0 2.0011777130924933 //2025/10/01 12:00/3 likes -拿起手機錄音 0 0 0.6360773310905286 0 0 1 0 1.936203406788339 //2025/06/30 14:32/1 likes -努力脫離社畜人生 3 0 -0.8645611087836036 0 0 1 0 1.4564498422732115 //2025/03/14 05:16/1 likes/1 replies -我才領兩萬多沒必要練習了 1 0 0.4182525108688182 0 0 1 0 0.7123675219146516 //2025/05/14 12:39/54 likes/2 replies -最鍾意見到呢D情況~ 1 0 1.268363934486012 0 0 1 0 1.4051122944260057 //2025/06/25 20:40 -那個同事還是負責情緒管理的培訓。 1 0 0.27097845726745984 0 0 1 0 0.7753685892815466 //2025/05/15 08:45/3 likes/2 replies -沒錯 1 0 1.8369562314153676 0 0 1 0 1.8432385883964495 //2025/09/23 14:33 -是時間自由 2 0 0.15428397751524603 0 0 1 0 0.23740258003289205 //2025/03/14 15:27/3 likes/1 replies -我進去吃冰過,所以想問 2 0 0.37163628223117495 0 0 1 0 1.9580578642491737 /undefined likes/undefined replies -想安穩好難 0 0 0.06854810643934162 0 0 1 0 1.2613532485363483 //2025/10/30 13:19/3 likes/1 replies -往前約半小時 1 0 1.0714415271275834 0 0 1 0 1.1272170999508635 //2026/01/08 09:53/2 likes -以前會主動,被社會洗禮後 2 0 2.0563903712755005 0 0 1 0 3.683200244263803 /undefined likes/undefined replies +如果隔壁現在開一倍 0 0 -0.455708811472717 0 0 1 0 3.8657247172243965 //2024/09/16 13:10/1 likes + 0 0 -1.8900155931575178 0 0 1 0 1.9023628695046 /undefined likes/undefined replies +我買170 0 0 -0.23358353776171814 0 0 1 0 4.022297634809797 //2024/09/16 13:03/1 replies +你家超美欸!! 0 0 -0.4136266842782961 0 0 1 0 5.332145932715964 //2024/09/17 00:42/1 replies +適合自己只有自己最知道! 0 0 -1.5896606582391373 0 0 1 0 1.6506509752136578 //2025/12/25 16:17/1 likes/1 replies +好多建設蓋起來了 0 0 -0.2660554324234905 0 0 1 0 4.346106858234708 //2024/09/16 01:37/8,076 likes/482 replies +我要找發財的房子 0 0 -3.594279403962245 0 0 1 0 4.080053003902635 //2026/01/01 20:51/1 likes +悲慘房奴 2 0 -0.6830561638135739 0 0 1 0 2.908978801783894 //2025/12/07 18:05 +每月房租1.8 2 0 -0.48447139968840247 0 0 1 0 3.516247126811615 //2025/04/07 22:20/1 likes +商家老闆再次 請慢用 2 0 -0.7003731781487827 0 0 1 0 1.8874219767044604 //2024/09/16 20:57/1 likes +請慢用~ 2 0 -0.21604964250614334 0 0 1 0 1.9404473325638902 //2024/09/16 15:46/1 likes +你家好漂亮欸😍 2 0 -0.6056955692947286 0 0 1 0 2.608007353824966 //2024/09/17 00:22/1 replies +獨立隔間 單人房 2 0 -1.304626202490688 0 0 1 0 3.32350465606919 //2025/12/30 02:19 +我貸款也要去租 2 0 -3.295196852101169 0 0 1 0 3.985429169224767 //2026/01/01 03:42/1 likes +當下住進去的時候 2 0 0.35475322470322723 0 0 1 0 2.2473713788844587 //2024/09/16 21:11 +付房租費 2 0 -0.8226459198390215 0 0 1 0 3.7283769498368344 //2025/04/07 23:03 +沒有地方好住 3 0 0.26362316440332734 0 0 1 0 1.1531349678488905 //2025/04/09 00:21/1 replies +為什麼竹科工程師是在板橋 3 0 -0.05907426619493883 0 0 1 0 0.9157159611842615 /undefined likes/undefined replies +你們家很漂亮欸 3 0 0.7485137126363446 0 0 1 0 5.7033763659814944 //2024/09/16 22:32/1 likes/1 replies +超值! 3 0 1.0339952484865522 0 0 1 0 4.730731670502431 //2024/09/16 15:07/2 likes/1 replies +房東壓力,不敢申請補助 3 0 0.6297676707502902 0 0 1 0 1.5949491148722628 //2025/12/27 19:55/291 likes/395 replies +沒有房租還有車有房 3 0 0.7373485456162294 0 0 1 0 1.3340737049006643 //2024/07/02 13:45 +八萬要租房 1 0 2.8369656274458386 0 0 1 0 3.08715213361605 //2025/08/03 19:25/1 likes +業配。 3 0 0.43206321806137726 0 0 1 0 5.159423554074238 //2024/09/16 20:55/1 replies +你哪來的學貸? 1 0 2.7338777491464876 0 0 1 0 3.353975170649582 //2025/12/28 02:13/5,416 likes/18 replies +住家裡存錢更多 1 0 2.640052443765976 0 0 1 0 3.057392764627019 //2025/08/04 00:49/28 likes +買的當下壓力好大 1 0 3.2311445731956114 0 0 1 0 5.001720618654962 //2024/09/16 18:07/1 replies +無房無車住家裡 0 0 -1.5207728864974719 0 0 1 0 1.838586297197233 //2025/03/14 16:49/1 likes +不一定付房貸車貸 0 0 -0.4074492639063214 0 0 1 0 1.5823112932219185 //2025/08/03 21:09/1 likes +在家享受房租 1 0 2.1180959211631647 0 0 1 0 2.8121724982017593 //2025/12/07 20:01/1 likes/1 replies +請慢用~ 0 0 -0.566269413622372 0 0 1 0 4.280248494734203 //2024/09/16 13:33/1 likes/1 replies +你哪來的學貸? 1 0 2.565698342461989 0 0 1 0 3.127826081826676 //2025/12/28 02:13/5,416 likes/18 replies +來玩ㄇ 3 0 0.29857174307511336 0 0 1 0 4.760712684896848 //2024/09/16 20:57 +大家看不懂 2 0 -0.10204827960964735 0 0 1 0 0.38400873167402655 //2025/08/04 00:26/6 likes/1 replies +做好自己,幸運就不會浪費 3 0 0.2204606724025524 0 0 1 0 0.47753799390172685 /undefined likes/undefined replies +得了便宜還賣乖 3 0 0.0894973608587879 0 0 1 0 0.6042400977966168 /undefined likes/undefined replies +房子在那? 1 0 -0.6506306244718321 0 0 1 0 0.768048784512705 //2026/01/01 13:33 +享受房租中 1 0 1.950685831872459 0 0 1 0 2.9894858950645995 //2025/12/07 23:12 +我更可憐吧 1 0 2.566268524969468 0 0 1 0 3.1083408057240494 /undefined likes/undefined replies +你自己賺錢換回來 3 0 -0.5106186313719681 0 0 1 0 0.7129387860071758 //2025/07/16 09:25 +有些自由,真的不便宜。 3 0 -0.16452905144356045 0 0 1 0 1.2645752511188597 //2025/04/07 08:30/2.0 萬 likes/150 replies +我要去租🤣🤣🤣 1 0 -0.36354829603130767 0 0 1 0 0.5356707876291918 //2026/01/01 16:35 +需要去 c 一下🤭 1 0 -0.5579395116704386 0 0 1 0 0.6136575908805135 //2026/01/01 21:33 + 1 0 1.4499210811067442 0 0 1 0 2.5051156916393866 //2025/10/04 19:02/1 likes/1 replies +大大的家好美❤️ 0 0 -0.18920620266299348 0 0 1 0 5.0050404558203985 //2024/09/16 19:11/1 likes/1 replies +你家超漂亮!!!! 1 0 2.774429722748586 0 0 1 0 4.882656817212039 //2024/09/16 11:24/2 likes/1 replies +看得我也想租😲 1 0 -0.223296313676963 0 0 1 0 0.5200583776951658 //2026/01/01 20:15 +有旺運財運的房屋 1 0 -0.40050864689247234 0 0 1 0 0.7541553201236338 //2026/01/01 13:39/1 likes +好美的家 3 0 0.5583743932329259 0 0 1 0 5.53071476912797 //2024/09/16 12:06/1 likes/1 replies +我想租 1 0 -0.3370632148590218 0 0 1 0 0.41522238280621643 //2026/01/01 15:56 diff --git a/dat_table_keyword__td_7768_6.tsv b/dat_table_keyword__td_7768_6.tsv index 3d268c4..0accd0e 100644 --- a/dat_table_keyword__td_7768_6.tsv +++ b/dat_table_keyword__td_7768_6.tsv @@ -1,5 +1,5 @@ id text tx ty tz group dist question -6 規訓 -1.8793827341448397 6.372825707414462 2.930603406097707 0 0.29420950451084604 你所遵守的社交習慣,哪些是天生的、哪些是後來學會的? -9 社畜 -0.3014127191855424 6.921562962444809 3.108239977944226 1 0.3929230338700692 你如何區分「工作時的你」與「下班後的你」? -11 監控 -2.4092554178953254 7.340263044093509 2.006674301867483 2 0.5965425438176765 如果沒人看見,你的行為表現會和現在有很大的差異嗎? -12 自由 0.5843862975584091 5.95464102814099 1.5188284178227252 3 0.30336174404598676 對你來說,什麼樣的狀態才叫「自由」? +1 窮忙 0.42948128834779487 -4.448928999433766 -5.539009809941537 0 0.7019542320848058 你今天的行程裡,有多少比例是為了自己? +4 租屋 -1.045980281922074 -7.869809910666323 -4.245497410767069 1 0.6950491059419176 這個月薪水的幾分之幾交給房東了? +10 邊界 0.07964552308406607 -4.743649682683703 -2.9649364503358275 2 0.4912924718032982 你什麼時候會說不,來保護自己? +16 做自己 -0.7864300146231561 -5.5847825447264405 -5.862022263863594 3 0.6285578689298785 在公共場所,你覺得自己有多少程度能呈現真實的樣貌? diff --git a/dat_table_lookat__td_24460_1.tsv b/dat_table_lookat__td_24460_1.tsv index c2e6545..693a3df 100644 --- a/dat_table_lookat__td_24460_1.tsv +++ b/dat_table_lookat__td_24460_1.tsv @@ -1,2 +1,2 @@ id text updateTime -11 監控 1777014617 +4 租屋 1777373620