diff --git a/260310-GrayScale.toe b/260310-GrayScale.toe new file mode 100644 index 0000000..5d84dbc Binary files /dev/null and b/260310-GrayScale.toe differ diff --git a/dat_table_json__td_7768_7.tsv b/dat_table_json__td_7768_7.tsv index 3d85018..cfe3b83 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 -大家看不懂 3 0 -0.4123532324273361 0 0 1 0 1.0372877294442566 -你哪來的學貸? 0 0 -0.749867176413578 0 0 1 0 0.7548669135932486 -介面超難用 2 0 -0.2408329902995598 0 0 1 0 0.4194029232209698 -真的嗎 0 0 0.4623510329966389 0 0 1 0 1.5048125315303627 -我打開是英文的 2 0 -0.7368388135608597 0 0 1 0 0.8494843186786402 -連結: skills.google 3 0 0.139395989566791 0 0 1 0 1.5977131286124318 -這肯定不是最近的 0 0 0.3370488241260117 0 0 1 0 1.4914315633910131 -幸運的我 接下來就是開始房貸人生 0 0 -0.19097668520390787 0 0 1 0 0.8094034955180638 -我買170 0 0 -1.1429481166751554 0 0 1 0 2.0670878753324895 -你哪來的學貸? 0 0 -0.6076332826864907 0 0 1 0 0.831596719738272 -你到底知不知道外面用人市場 3 0 0.24217833683989254 0 0 1 0 0.6471301997319437 -無法同意您更多~ 1 0 -0.6491252211789924 0 0 1 0 0.8838320528906913 -邊讀邊還 0 0 0.01362608847808855 0 0 1 0 0.4560166636586928 -還沒看懂在討論什麼 1 0 -0.42005793241928235 0 0 1 0 0.6063709493275319 -那什麼啦 0 0 -0.9619281018682606 0 0 1 0 1.562724354763271 -請問出處 2 0 -1.850633716215873 0 0 1 0 2.5764247392782 -你看差多少 0 0 0.06565028895161262 0 0 1 0 1.325940426133994 -學貸晚點還沒關係 0 0 0.2527370656563437 0 0 1 0 0.41113186647926575 -最近也考慮買一間 0 0 -1.3493273548166158 0 0 1 0 1.7581974612719224 -最近貸款通過的朋友 0 0 0.38717201572801146 0 0 1 0 1.2072201654367076 -@ariki_fudo66 1 0 -0.15040365289201324 0 0 1 0 0.7017093686995065 -商家老闆再次 請慢用 0 0 -0.919191543387093 0 0 1 0 2.289049732331217 -來玩ㄇ 0 0 -1.09850381870088 0 0 1 0 2.3271496457556493 -哪裡找字幕 1 0 -0.2829123163571337 0 0 1 0 0.9044507454678385 -公司幫妳付房貸 0 0 -1.1904257349467433 0 0 1 0 1.4597990188612395 -超值! 0 0 -1.2767048888866745 0 0 1 0 2.2807317610058684 -可以聊聊唷~ 0 0 0.4291699409620805 0 0 1 0 0.8488469451510265 -請問您使用5的couesera 0 0 -0.29592086016284935 0 0 1 0 2.2052729631614167 -我貸款也要去租 0 0 -0.8632559828838402 0 0 1 0 1.6100039168811777 -別把負債想的太可怕 0 0 -0.6581992846805238 0 0 1 0 0.8823466887149647 -附上網頁連結 2 0 -0.23352137567511216 0 0 1 0 0.587397373356631 -請各位用低收入戶稱呼 2 0 -1.1677991871458164 0 0 1 0 1.7900899890708353 -好辦法 1 0 -0.3040354768710512 0 0 1 0 0.6092131083608139 -有保證付多少年嗎 0 0 -0.9288624221613426 0 0 1 0 1.1682449839328297 -TOEFL GRE 等級單字 1 0 -1.1760779337182221 0 0 1 0 1.1987248938430015 -會考根本不到比天賦 3 0 0.06603930321894402 0 0 1 0 0.4665953643001922 -如果隔壁現在開一倍 0 0 -1.3532551932477486 0 0 1 0 1.9823045326399789 -查了一下privilege 3 0 -0.5001426003678001 0 0 1 0 1.0205040739539888 -@yi_yun118 0 0 0.29242417651199304 0 0 1 0 0.7307821467427014 -卡 0 0 -0.5566518076134661 0 0 1 0 1.5507082063554192 -課題分離~ 3 0 0.02997201989300602 0 0 1 0 0.528884272662012 -想知道設計師 1 0 -2.031469668951889 0 0 1 0 3.1476648393891007 -知道要表達什麼 1 0 -1.10120012212523 0 0 1 0 1.742446282305988 -公主要貸款? 0 0 -0.3714880915344334 0 0 1 0 0.9218583587854745 -學費了嗎 0 0 -0.9875300974973007 0 0 1 0 1.2815582088349062 -幸運的我 接下來就是開始房貸人生 0 0 -0.2861858394628365 0 0 1 0 0.9841637973284564 -我這樣算整頓職場嗎? 1 0 -0.3079486530206824 0 0 1 0 1.016091969722521 -privilege 這個字只能用複製的 1 0 -0.9831746995029098 0 0 1 0 1.0817608785197124 -懂了嗎 1 0 -0.947187933736089 0 0 1 0 1.6790177606648218 -我是4473🫠 0 0 -0.3231551917528649 0 0 1 0 1.0936771089940382 +text group center_x center_y center_z axis_x axis_y axis_z radius info +上司來幫我把界線擦掉 3 0 0.13527939973978498 0 0 1 0 0.9330429250069002 //2026/01/02 11:23/2 likes/1 replies +你這顆阿智頭 1 0 0.8955586005542111 0 0 1 0 1.3456533050895447 /undefined likes/undefined replies +做好自己,幸運就不會浪費 1 0 -0.21840345692995555 0 0 1 0 0.5716341981980778 /undefined likes/undefined replies +該反思的是資方 3 0 0.09674679477939385 0 0 1 0 1.1888534467511183 //2025/09/07 07:36/35 likes +僅適用2015-2020 2 0 -0.9100079574188724 0 0 1 0 1.651897472037215 //2025/09/18 01:38/1 likes +只想把事做好的人 1 0 3.4534584504099772 0 0 1 0 4.0315163601361625 //2025/10/31 16:38/3 likes/1 replies +別人過不了的坎 1 0 1.5337140656632053 0 0 1 0 1.8702744813909467 /undefined likes/undefined replies +我是旁邊那個 1 0 1.1691254387339125 0 0 1 0 1.4416843741191505 /undefined likes/undefined replies +專注打造 不必辯解 1 0 -0.30495162113313157 0 0 1 0 0.3700370814615318 /undefined likes/undefined replies +得了便宜還賣乖 1 0 -0.44941934804807904 0 0 1 0 0.8140837654275606 /undefined likes/undefined replies +長大才知道的道理 1 0 -0.3536728672747067 0 0 1 0 0.5732039459684202 /undefined likes/undefined replies +專注工作,這才是成熟 1 0 3.182561574682074 0 0 1 0 3.4841641324215544 //2026/01/02 01:32/51 likes/2 replies +修煉還不夠🥲 1 0 3.114535902406356 0 0 1 0 3.5684396358932466 //2025/05/14 18:25/1 likes/1 replies +最鍾意見到呢D情況~ 1 0 4.307196181183603 0 0 1 0 4.569342980313155 //2025/06/25 20:40 +還是得美化這段時間 3 0 0.17603038587816577 0 0 1 0 1.1172826139877423 //2025/09/07 14:46/1 likes +怕人家沒事做 2 0 0.8111105028706422 0 0 1 0 1.0772723067696433 /undefined likes/undefined replies +再次提醒重要的事壓 1 0 -0.5803278799272249 0 0 1 0 0.6447038177627391 /undefined likes/undefined replies +不去指點評判,是成年人基本素養 1 0 0.061982463426175194 0 0 1 0 0.6383398426925163 /undefined likes/undefined replies +承擔更大的期待或責任 1 0 -0.563505153376429 0 0 1 0 0.7666046214223337 /undefined likes/undefined replies +不要花時間成全別人 1 0 1.1446725080712241 0 0 1 0 1.93390762886273 //2025/09/24 01:23 +你只會被利用 1 0 4.290734664817258 0 0 1 0 4.632786299656224 //2025/12/06 17:42 +公司給你自由不代表你可以隨心所欲 1 0 3.268209411899523 0 0 1 0 3.345272069177171 //2025/08/07 15:31/187 likes/2 replies +刷題刷到想睡覺 0 0 0.07277517938206479 0 0 1 0 0.5207159361215036 //2025/09/17 17:56/5 likes +负重前行有人替你 1 0 4.2446402765336035 0 0 1 0 4.837241824489712 //2025/09/08 21:39/2 likes +到處複製的 1 0 1.190832058763073 0 0 1 0 1.8176438057951394 //2025/04/07 10:57/2 likes +成熟的人都該理解且施行 1 0 3.4347255805028247 0 0 1 0 3.658345995559953 //2026/01/01 20:14/3 likes/1 replies +公司不允许,领导不允许 3 0 -0.38936305685476214 0 0 1 0 1.1564178616825793 //2026/01/02 12:30/6 likes/1 replies +請問出處 1 0 1.6241358837257085 0 0 1 0 2.2825813865871267 //2025/09/29 03:25/2 likes +不要為了害怕孤單而合群, 1 0 0.9085048637258364 0 0 1 0 1.564542314779933 /undefined likes/undefined replies +資源自己找 1 0 3.9906385330868996 0 0 1 0 4.330988660572437 //2025/08/15 14:48/1 likes +為什麼你標記我 1 0 0.5131560136303142 0 0 1 0 1.260381407922729 //2025/02/12 01:12 +積極的放過自己 1 0 1.8775196052764862 0 0 1 0 2.1891246422929185 /undefined likes/undefined replies +你到底知不知道外面用人市場 3 0 0.028982039123400583 0 0 1 0 0.82106942307723 //2025/09/06 23:45/64 likes +空窗期間的探索自我 1 0 4.161833175590305 0 0 1 0 5.085438288539164 //2025/09/07 17:08/2 likes +真的該提醒自己 1 0 3.7817097728101157 0 0 1 0 3.9825512747364233 //2025/09/23 19:37/1 likes +真的很厲害 1 0 2.0096186104441305 0 0 1 0 2.1369164647242647 //2025/09/17 18:49/2 likes +保持距離好 3 0 -2.3480623703386163 0 0 1 0 3.1920448595611397 //2025/10/23 07:04 +留言自己看 1 0 3.4164613304771283 0 0 1 0 4.066512443533217 //2026/01/02 16:44 +有人要闖進來破壞 3 0 -0.000378240893809334 0 0 1 0 0.4087482101120305 //2025/08/17 11:08/1 likes +事情都堆到自己 1 0 2.953534775011738 0 0 1 0 3.1066192287696537 /undefined likes/undefined replies +是在影射某人 1 0 0.8563281207547373 0 0 1 0 1.3463283673856894 //2024/07/01 20:12 +沒了身體怎麼工作 1 0 4.239252972491689 0 0 1 0 4.992860256142344 //2025/09/07 04:56/68 likes/2 replies +鎖留言我回不了喔 0 0 1.5540724063448774 0 0 1 0 2.098720004919064 //2025/10/31 16:52/2 likes +鑰匙不發在網路上唷 2 0 -0.02481751023163703 0 0 1 0 0.838945398889098 /undefined likes/undefined replies +暫時退出所有line群組 3 0 -0.25171030806065176 0 0 1 0 0.8504433782029613 //2026/01/02 13:28/3 likes/1 replies +想安穩好難 0 0 1.9200968481766179 0 0 1 0 2.438902757041213 //2025/10/30 13:19/3 likes/1 replies +不要來鬧事。 3 0 0.12807415648868137 0 0 1 0 1.3292927374179153 //2025/06/26 02:26 +你在幹嘛? 1 0 4.063666761355787 0 0 1 0 4.548450096331603 //2025/09/01 14:32/13 likes/1 replies +只要一組資料,就可能闖入我家! 2 0 -0.5547524230562173 0 0 1 0 0.9079295779311662 /undefined likes/undefined replies +大破防 1 0 1.5196480778269423 0 0 1 0 1.7752039619631077 //2024/03/10 12:27 diff --git a/dat_table_keyword__td_7768_6.tsv b/dat_table_keyword__td_7768_6.tsv index d81f11f..31dfaeb 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 -3 學貸 5.006850706144017 -0.3937508764344644 -3.8028395349683612 0 0.6999431120800679 -10 邊界 8.42051332674133 -0.6725770506631371 -4.245520249697503 1 0.25132005276280606 -15 主體 7.641380380701039 0.17865233926193508 -3.224946864645592 2 0.11523702488157918 -17 誰懂 8.107236364520066 0.13964310414056988 -3.6591765364180584 3 0.09811323645749676 +2 內耗 -6.624351257833919 6.689745896123492 1.0128135561238645 0 0.09367293885336629 +10 邊界 -6.864949720010282 8.746103406421183 1.3427824388597331 1 1.6219144251873796 +11 監控 -6.824430818041262 8.068476072658063 -0.15140169083913632 2 0.08288971769679856 +16 做自己 -5.254637624109385 4.821395269694275 1.7165039909369129 3 0.2036517676999929 diff --git a/dat_table_lookat__td_24460_1.tsv b/dat_table_lookat__td_24460_1.tsv index 6a4d909..7a5e92d 100644 --- a/dat_table_lookat__td_24460_1.tsv +++ b/dat_table_lookat__td_24460_1.tsv @@ -1,2 +1,2 @@ id text updateTime -3 學貸 1773050988 +10 邊界 1773144589 diff --git a/text_to_arc_script.py b/text_to_arc_script.py index 1362c83..9b2d6ca 100644 --- a/text_to_arc_script.py +++ b/text_to_arc_script.py @@ -1,16 +1,16 @@ import math + # me - this DAT # scriptOp - the OP which is cooking -# -# press 'Setup Parameters' in the OP to call this function to re-create the parameters. + def onSetupParameters(scriptOp): page = scriptOp.appendCustomPage('Custom') page.appendFloat('Valuea', label='Value A') page.appendFloat('Valueb', label='Value B') return + def onCook(scriptOp): scriptOp.clear() - # Define Table Header with position and rotation columns scriptOp.appendRow(['text', 'P(X)', 'P(Y)', 'P(Z)', 'R(X)', 'R(Y)', 'R(Z)']) # --- Fetch External Parameters --- @@ -18,51 +18,90 @@ def onCook(scriptOp): if not const_op: return - radius_scale = const_op['ring_scale'] - rotate_speed = const_op['rotate_speed'] - # text_space: used to define the angular gap between characters - text_space = const_op['text_space'] + # Fix for L22: CHOPs are not directly iterable. + # We check for channel existence using the [] accessor and a fallback. + def get_chan(chan_name, default=1.0): + c = const_op[chan_name] + return c.eval() if c is not None else default + + radius_scale = get_chan('ring_scale', 1.0) + rotate_speed = get_chan('rotate_speed', 1.0) + text_space = get_chan('text_space', 0.5) + arc_table = op('arc_table') + info_table = op('info_table') + scaled_pos_op = op('scaled_positions') + ring_const = op('/project1/RingConstant') + draw_arc=parent().par.Drawarc.eval() if hasattr(parent().par, 'Drawarc') else False + + # Safety check for required info + if not ring_const: + return + + # Assuming ring_const is a Constant CHOP as well + def get_remote_chan(op_ref, chan_name, default=1.0): + if not op_ref: return default + c = op_ref[chan_name] + return c.eval() if c is not None else default + + f_size = get_remote_chan(ring_const, 'FontSize', 1.0) + i_size = get_remote_chan(ring_const, 'InfoFontSize', 1.0) + info_scale = i_size / f_size if f_size != 0 else 1.0 if arc_table: arc_table.clear() - arc_table.appendRow(['tx', 'ty', 'tz','rx', 'ry', 'rz','scale']) + arc_table.appendRow(['tx', 'ty', 'tz','rx', 'ry', 'rz','scale', 'start1', 'end1', 'start2', 'end2']) + + if info_table: + info_table.clear() + info_table.appendRow(['text', 'tx', 'ty', 'tz', 'rx', 'ry', 'rz']) for source in scriptOp.inputs: - # Safety check: Input must exist and have at least a header and one data row if not source or source.numRows < 2: continue - # Iterate through the rows of the source DAT for i, row in enumerate(source.rows()[1:]): - full_string = row[0].val + # Ensure index exists for substring column + sub_string = row[9].val if len(row) > 9 else "" if not full_string: continue str_len = len(full_string) + sub_str_len = len(sub_string) - # Fetch speed variation from the speed_variation CHOP + # Fetch speed variation from CHOP speed_op = op('speed_variation') - speed_variation = speed_op[0][i] if speed_op and i < speed_op.numSamples else 0 + speed_variation = 0 + if speed_op: + # Use first channel, i-th sample + if i < speed_op.numSamples: + speed_variation = speed_op[0][i] - # Calculate time-based rotation offset (in radians) - time_offset = absTime.seconds * rotate_speed *(1.0+ abs(speed_variation))/10.0 + # Time calculation + time_offset = absTime.seconds * rotate_speed * (1.0 + abs(speed_variation)) / 10.0 try: - center = [op('scaled_positions')[0][i], op('scaled_positions')[1][i], op('scaled_positions')[2][i]] - axis = [float(row[5]), float(row[6]), float(row[7])] + # Use scaled_positions if it exists, otherwise default to origin + if scaled_pos_op and i < scaled_pos_op.numSamples: + center = [scaled_pos_op[0][i], scaled_pos_op[1][i], scaled_pos_op[2][i]] + else: + center = [0, 0, 0] + + axis = [float(row[5]), float(row[6]), float(row[7])] radius = float(row[8]) * radius_scale except (ValueError, TypeError, IndexError): continue - # --- Calculate Orthogonal Basis for the Ring Plane --- + + # --- Calculate Orthogonal Basis --- ax, ay, az = axis mag = math.sqrt(ax*ax + ay*ay + az*az) if mag == 0: ax, ay, az = 0, 1, 0 else: ax, ay, az = ax/mag, ay/mag, az/mag + if abs(ax) < 0.9: tx, ty, tz = 1, 0, 0 else: @@ -72,75 +111,113 @@ def onCook(scriptOp): uy = az*tx - ax*tz uz = ax*ty - ay*tx umag = math.sqrt(ux*ux + uy*uy + uz*uz) + if umag == 0: umag = 1 ux, uy, uz = ux/umag, uy/umag, uz/umag vx = ay*uz - az*uy vy = az*ux - ax*uz vz = ax*uy - ay*ux + # --- Calculate Arc Logic --- - # Instead of forcing (i/str_len)*2*pi, we use text_space to determine the gap. - # If the total arc (gap * characters) < 2*pi, it remains an arc. - angular_step = text_space / (radius if radius > 0 else 1) - # angular_step = radius*math.pi*2.0/text_space if radius>0 else math.pi*2.0/str_len - total= math.floor(math.pi*2.0/(angular_step)) - count=0 - print(f"Processing string with length {str_len}, total positions: {total}") - # Build the table character by character - while count 0.1 else 0.1) + + # SAFETY: Limit total iterations + total = int(min(math.floor((math.pi * 2.0) / (angular_step if angular_step > 0.01 else 0.01)), 500)) + total = max(total, str_len + sub_str_len*.5) + + arc_len = round((total - (str_len + sub_str_len*.5)) / 2) + total= str_len + arc_len*2 + sub_str_len - # angle = (index * step) + time_offset - angle = ((count) * angular_step) + time_offset + angle = time_offset + + # arc1_start_angle=str_len*angular_step + # arc1_end_angle=arc1_start_angle + arc_len*angular_step + + # arc2_start_angle=arc1_end_angle+(sub_str_len*angular_step*info_scale*.5) + # arc2_end_angle=arc2_start_angle + arc_len*angular_step + + arc1_start_angle=angular_step * str_len #+time_offset%(2*math.pi) + arc1_end_angle=arc1_start_angle + arc_len*angular_step + + arc2_start_angle=arc1_end_angle+((sub_str_len)*angular_step*info_scale*.5) + arc2_end_angle=math.pi*2.0 #arc2_start_angle + arc_len*angular_step + + for count in range(total): + is_sub_str_zone = (count >= str_len + arc_len) and (count < str_len + arc_len + sub_str_len) + + step_mult = info_scale*.5 if is_sub_str_zone else 1.0 + angle += (angular_step * step_mult) cos_a = math.cos(angle) * radius sin_a = math.sin(angle) * radius - # Outward vector relative to center off_x = (ux * cos_a) + (vx * sin_a) off_y = (uy * cos_a) + (vy * sin_a) off_z = (uz * cos_a) + (vz * sin_a) - # Final World Position - px = center[0] + off_x + parent().par.Keywordpositionx - py = center[1] + off_y + parent().par.Keywordpositiony - pz = center[2] + off_z + parent().par.Keywordpositionz + kpx = getattr(parent().par, 'Keywordpositionx', 0) + kpy = getattr(parent().par, 'Keywordpositiony', 0) + kpz = getattr(parent().par, 'Keywordpositionz', 0) + + px = center[0] + off_x + kpx + py = center[1] + off_y + kpy + pz = center[2] + off_z + kpz + # px=off_x + kpx + # py=off_y + kpy + # pz=off_z + kpz - # --- Calculate Rotations to face outside --- dist = math.sqrt(off_x**2 + off_y**2 + off_z**2) - if dist > 0: - nx, ny, nz = off_x/dist, off_y/dist, off_z/dist - else: - nx, ny, nz = 0, 0, 1 + nx, ny, nz = (off_x/dist, off_y/dist, off_z/dist) if dist > 0 else (0,0,1) char_ry = math.degrees(math.atan2(nx, nz)) - char_rx = math.degrees(math.asin(-ny)) + 90 - char_rz = 0 + char_rx = math.degrees(math.asin(max(-1, min(1, -ny)))) + 90 tan_x = (ux * -math.sin(angle)) + (vx * math.cos(angle)) tan_y = (uy * -math.sin(angle)) + (vy * math.cos(angle)) tan_z = (uz * -math.sin(angle)) + (vz * math.cos(angle)) line_ry = math.degrees(math.atan2(tan_x, tan_z)) - 90 - line_rx = math.degrees(math.asin(-tan_y)) + line_rx = math.degrees(math.asin(max(-1, min(1, -tan_y)))) - # ry = math.degrees(math.atan2(nx, nz)) - # rx = math.degrees(math.asin(-ny))-90 - # rz = 0 - if count>=str_len: - scale= radius*angular_step if radius>0 else 1 - arc_table.appendRow([px, py, pz, line_rx, line_ry, 0, scale*0.5]) - # scriptOp.appendRow(['-', px, py, pz, char_rx, char_ry, 0]) - else: - char = full_string[count] - scriptOp.appendRow([char, px, py, pz, char_rx, char_ry, 0]) - # arc_table.appendRow([px, py, pz, rx, ry, rz, 1.0]) + if count==0: + pi=math.pi/2.0 + two_pi=math.pi*2.0 + half_pi=math.pi*0.5 + arc_table.appendRow([center[0]+ kpx, center[1]+ kpy, center[2]+ kpz, + 90, time_offset/math.pi*180.0, 0, radius, + (arc1_start_angle)/two_pi, + (arc1_end_angle)/two_pi, + (arc2_start_angle)/two_pi, + (arc2_end_angle)/two_pi, + ]) # Header for arc table - count+=1 - + if count < str_len: + char = full_string[count] + scriptOp.appendRow([char, px, py, pz, char_rx, char_ry, 0]) + + elif count < str_len + arc_len: + continue + # if arc_table and draw_arc: + # scale = (radius * angular_step * 0.5) if radius > 0 else 0.1 + # arc_table.appendRow([px, py, pz, line_rx, line_ry, 0, scale]) + + elif count < str_len + arc_len + sub_str_len: + char_idx = count - (str_len + arc_len) + if char_idx < len(sub_string): + char = sub_string[char_idx] + if info_table: + # continue + info_table.appendRow([char, px, py, pz, char_rx, char_ry, 0]) + + else: + continue + # if arc_table and draw_arc: + # scale = (radius * angular_step * 0.5) if radius > 0 else 0.1 + # arc_table.appendRow([px, py, pz, line_rx, line_ry, 0, scale]) return + def onGetCookLevel(scriptOp): return CookLevel.ALWAYS \ No newline at end of file