চিত্র:Penang island.stl
পাতাটির বিষয়বস্তু অন্যান্য ভাষায় নেই।
অবয়ব
এই STL ফাইলের জন্য এই PNG প্রাকদর্শনের আকার: ৮০০ × ৬০০ পিক্সেল। অন্যান্য আকারসমূহ: ৩২০ × ২৪০ পিক্সেল | ৬৪০ × ৪৮০ পিক্সেল | ১,০২৪ × ৭৬৮ পিক্সেল | ১,২৮০ × ৯৬০ পিক্সেল | ২,৫৬০ × ১,৯২০ পিক্সেল | ৫,১২০ × ৩,৮৪০ পিক্সেল।
পূর্ণ রেজোলিউশন (৫,১২০ × ২,৮৮০ পিক্সেল, ফাইলের আকার: ২.৫৪ মেগাবাইট, এমআইএমই ধরন: application/sla)
এই ফাইলটি উইকিমিডিয়া কমন্স থেকে নেওয়া। সেখানের বর্ণনা পাতার বিস্তারিত নিম্নে দেখানো হলো। (সম্পাদনা)
|
View Penang island.stl on viewstl.com
সারাংশ
বিবরণPenang island.stl |
English: Penang Island terrain 3D model based on ASTER Global DEMv2 data by CMG Lee. |
|
তারিখ | ||
উৎস | নিজের কাজ | |
লেখক | Cmglee | |
অন্যান্য সংস্করণ |
|
Python source
#!/usr/bin/env python
header = 'Penang Island terrain 3D model based on ASTER Global DEM data by CMG Lee.'
path_dem = 'Penang_Island_heightmap_ASTGTM2_N05E100_dem_20pc.png'
scale = 5e-2
thickness = 1
import re, struct, math, png
def fmt(string): ## string.format(**vars()) using tags {expression!format} by CMG Lee
def f(tag): i_sep = tag.rfind('!'); return (re.sub('\.0+$', '', str(eval(tag[1:-1])))
if (i_sep < 0) else ('{:%s}' % tag[i_sep + 1:-1]).format(eval(tag[1:i_sep])))
return (re.sub(r'(?<!{){[^{}]+}', lambda m:f(m.group()), string)
.replace('{{', '{').replace('}}', '}'))
def append(obj, string): return obj.append(fmt(string))
def tabbify(cellss, separator='|'):
cellpadss = [list(rows) + [''] * (len(max(cellss, key=len)) - len(rows)) for rows in cellss]
fmts = ['%%%ds' % (max([len(str(cell)) for cell in cols])) for cols in zip(*cellpadss)]
return '\n'.join([separator.join(fmts) % tuple(rows) for rows in cellpadss])
def hex_rgb(colour): ## convert [#]RGB to #RRGGBB and [#]RRGGBB to #RRGGBB
return '#%s' % (colour if len(colour) > 4 else ''.join([c * 2 for c in colour])).lstrip('#')
def viscam_colour(colour):
colour_hex = hex_rgb(colour)
colour_top5bits = [int(colour_hex[i:i+2], 16) >> 3 for i in range(1,7,2)]
return (1 << 15) + (colour_top5bits[0] << 10) + (colour_top5bits[1] << 5) + colour_top5bits[2]
def roundm(x, multiple=1):
if (isinstance(x, tuple)): return tuple(roundm(list(x), multiple))
elif (isinstance(x, list )): return [roundm(x_i, multiple) for x_i in x]
else: return int(math.floor(float(x) / multiple + 0.5)) * multiple
def flatten(lss): return [l for ls in lss for l in ls]
def rotate(facetss, degs): ## around x then y then z axes
(deg_x,deg_y,deg_z) = degs
(sin_x,cos_x) = (math.sin(math.radians(deg_x)), math.cos(math.radians(deg_x)))
(sin_y,cos_y) = (math.sin(math.radians(deg_y)), math.cos(math.radians(deg_y)))
(sin_z,cos_z) = (math.sin(math.radians(deg_z)), math.cos(math.radians(deg_z)))
facet_rotatess = []
for facets in facetss:
facet_rotates = []
for i_point in range(4):
(x, y, z) = [facets[3 * i_point + i_xyz] for i_xyz in range(3)]
if (x is None or y is None or z is None):
facet_rotates += [x, y, z]
else:
(y, z) = (y * cos_x - z * sin_x, y * sin_x + z * cos_x) ## rotate about x
(x, z) = (x * cos_y + z * sin_y, -x * sin_y + z * cos_y) ## rotate about y
(x, y) = (x * cos_z - y * sin_z, x * sin_z + y * cos_z) ## rotate about z
facet_rotates += [round(value, 9) for value in [x, y, z]]
facet_rotatess.append(facet_rotates)
return facet_rotatess
def translate(facetss, ds): ## ds = (dx,dy,dz)
return [facets[:3] + [facets[3 * i_point + i_xyz] + ds[i_xyz]
for i_point in range(1,4) for i_xyz in range(3)]
for facets in facetss]
## Read elevation data
(map_width, map_height, map_pixels, map_metadatas) = png.Reader(path_dem).read_flat()
print(map_width, map_height, len(map_pixels), map_metadatas)
heightss = [[map_pixels[4 * (map_width * y + x) + 1]
for y in range(map_height)] for x in range(map_width)]
## Add facets
facetss = []
for y in range(map_height - 1):
for x in range(map_width - 1):
(x0, y0, x1, y1) = (x, -y, x + 1, -(y + 1))
z00 = heightss[x ][y ] * scale
z01 = heightss[x ][y + 1] * scale
z11 = heightss[x + 1][y + 1] * scale
z10 = heightss[x + 1][y ] * scale
if (abs(z00 - z11) < abs(z01 - z10)):
if (z11 != 0 or z10 != 0 or z00 != 0):
facetss.append([None,0,0, x1,y1,z11, x1,y0,z10, x0,y0,z00])
if (z00 != 0 or z01 != 0 or z11 != 0):
facetss.append([None,0,0, x0,y0,z00, x0,y1,z01, x1,y1,z11])
else:
if (z10 != 0 or z00 != 0 or z01 != 0):
facetss.append([None,0,0, x1,y0,z10, x0,y0,z00, x0,y1,z01])
if (z01 != 0 or z11 != 0 or z10 != 0):
facetss.append([None,0,0, x0,y1,z01, x1,y1,z11, x1,y0,z10])
# sys.stdout.write(chr(int(math.ceil(heightss[x][y] * 0.1)) + 32))
# print('')
# writer = png.Writer(width=map_width, height=map_height, alpha=map_metadatas['alpha'])
# writer.write_array(open('test.png', 'wb'), map_pixels)
facetss += [facets[0: 5] + [max(0, facets[ 5] - thickness)] +
facets[9:11] + [max(0, facets[11] - thickness)] +
facets[6: 8] + [max(0, facets[ 8] - thickness)] for facets in facetss]
# facetss = [facets[:3] + facets[6:9] + facets[3:6] + facets[9:] for facets in facetss] ## flip
## Calculate normals
for facets in facetss:
if (facets[0] is None or facets[1] is None or facets[2] is None):
us = [facets[i_xyz + 9] - facets[i_xyz + 6] for i_xyz in range(3)]
vs = [facets[i_xyz + 6] - facets[i_xyz + 3] for i_xyz in range(3)]
normals = [us[1]*vs[2] - us[2]*vs[1], us[2]*vs[0] - us[0]*vs[2], us[0]*vs[1] - us[1]*vs[0]]
normal_length = sum([component * component for component in normals]) ** 0.5
facets[:3] = [-round(component / normal_length, 10) for component in normals]
# print(tabbify([['N%s' % (xyz ) for xyz in list('xyz')] +
# ['%s%d' % (xyz, n) for n in range(3) for xyz in list('XYZ')] + ['RGB']] + facetss))
## Compile STL
outss = ([[('STL\n\n%-73s\n\n' % (header[:73])).encode('utf-8'), struct.pack('<L',len(facetss))]] +
[[struct.pack('<f',float(value)) for value in facets[:12]] +
[struct.pack('<H',0 if (len(facets) <= 12) else
viscam_colour(facets[12]))] for facets in facetss])
out = b''.join([bytes(out) for outs in outss for out in outs])
# out += ('\n\n## Python script to generate STL\n\n%s\n' % (open(__file__).read())).encode('utf-8')
print("# bytes:%d\t# facets:%d\ttitle:\"%-73s\"" % (len(out), len(facetss), header[:73]))
with open(__file__[:__file__.rfind('.')] + '.stl', 'wb') as f_out: f_out.write(out)
লাইসেন্স প্রদান
আমি, এই কাজের স্বত্বাধিকারী, এতদ্দ্বারা আমি এই কাজকে নিম্ন বর্ণিত লাইসেন্সের আওতায় প্রকাশ করলাম:
এই ফাইলটি ক্রিয়েটিভ কমন্স অ্যাট্রিবিউশন-শেয়ার অ্যালাইক ৪.০ আন্তর্জাতিক লাইসেন্সের আওতায় লাইসেন্সকৃত।
- আপনি স্বাধীনভাবে:
- বণ্টন করতে পারেন – এ কাজটি অনুলিপি, বিতরণ এবং প্রেরণ করতে পারেন
- পুনঃমিশ্রণ করতে পারেন – কাজটি অভিযোজন করতে পারেন
- নিম্নের শর্তাবলীর ভিত্তিতে:
- স্বীকৃতিপ্রদান – আপনাকে অবশ্যই যথাযথ স্বীকৃতি প্রদান করতে হবে, লাইসেন্সের একটি লিঙ্ক সরবরাহ করতে হবে এবং কোনো পরিবর্তন হয়েছে কিনা তা নির্দেশ করতে হবে। আপনি যেকোনো যুক্তিসঙ্গত পদ্ধতিতে এটি করতে পারেন। কিন্তু এমন ভাবে নয়, যাতে প্রকাশ পায় যে লাইসেন্সধারী আপনাকে বা আপনার এই ব্যবহারের জন্য অনুমোদন দিয়েছে।
- একইভাবে বণ্টন – আপনি যদি কাজটি পুনঃমিশ্রণ, রুপান্তর, বা এর ওপর ভিত্তি করে নতুন সৃষ্টিকর্ম তৈরি করেন, তবে আপনাকে অবশ্যই আপনার অবদান একই লাইসেন্স বা একই রকমের লাইসেন্সের আওতায় বিতরণ করতে হবে।
The uploader of this file has agreed to the Wikimedia Foundation 3D patent license: This file and any 3D objects depicted in the file are both my own work. I hereby grant to each user, maker, or distributor of the object depicted in the file a worldwide, royalty-free, fully-paid-up, nonexclusive, irrevocable and perpetual license at no additional cost under any patent or patent application I own now or in the future, to make, have made, use, offer to sell, sell, import, and distribute this file and any 3D objects depicted in the file that would otherwise infringe any claims of any patents I hold now or in the future. Please note that in the event of any differences in meaning or interpretation between the original English version of this license and a translation, the original English version takes precedence. |
এই ফাইলে চিত্রিত আইটেমগুলি
যা চিত্রিত করে
কিছু মানের উইকিউপাত্ত আইটেম নেই
৩১ মার্চ 2018
ফাইলের ইতিহাস
যেকোনো তারিখ/সময়ে ক্লিক করে দেখুন ফাইলটি তখন কী অবস্থায় ছিল।
তারিখ/সময় | সংক্ষেপচিত্র | মাত্রা | ব্যবহারকারী | মন্তব্য | |
---|---|---|---|---|---|
বর্তমান | ১২:৫৪, ৩১ মার্চ ২০১৮ | ৫,১২০ × ২,৮৮০ (২.৫৪ মেগাবাইট) | Cmglee | User created page with UploadWizard |
সংযোগসমূহ
নিচের পৃষ্ঠা(গুলো) থেকে এই ছবিতে সংযোগ আছে:
ফাইলের বৈশ্বিক ব্যবহার
নিচের অন্যান্য উইকিগুলো এই ফাইলটি ব্যবহার করে:
- en.wikipedia.org-এ ব্যবহার
- vi.wikipedia.org-এ ব্যবহার
- www.wikidata.org-এ ব্যবহার