/*
Intersection of a Line and a Sphere (or circle)
Written by Paul Bourke

http://paulbourke.net/geometry/sphereline/

Calculate the intersection of a ray and a sphere
The line segment is defined from p1 to p2
The sphere is of radius r and centered at sc
There are potentially two points of intersection given by
p = p1 + mu1 (p2 – p1)
p = p1 + mu2 (p2 – p1)
Return FALSE if the ray doesn’t intersect the sphere.

Maxscript version by Royal Ghost | http://veda3d.com
Version : 1.0.0
*/

fn RaySphere p1 p2 sc r =
(
local mu1
local mu2
local pt1 = undefined
local pt2 = undefined
local dp = [0,0,0]
local EPS = 0.00001

dp.x = p2.x – p1.x
dp.y = p2.y – p1.y
dp.z = p2.z – p1.z
a = dp.x * dp.x + dp.y * dp.y + dp.z * dp.z
b = 2.0 * (dp.x * (p1.x – sc.x) + dp.y * (p1.y – sc.y) + dp.z * (p1.z – sc.z))
c = sc.x * sc.x + sc.y * sc.y + sc.z * sc.z
c += p1.x * p1.x + p1.y * p1.y + p1.z * p1.z
c -= 2.0 * (sc.x * p1.x + sc.y * p1.y + sc.z * p1.z)
c -= r * r
bb4ac = b * b – 4.0 * a * c

if bb4ac 0.0 then
(
– first intersection
mu1 = (-b + sqrt(bb4ac)) / (2.0 * a)
pt1 = [p1.x + mu1 * (p2.x - p1.x),p1.y + mu1 * (p2.y - p1.y), p1.z + mu1 * (p2.z - p1.z)]

– second intersection
mu2 = (-b – sqrt(bb4ac)) / (2.0 * a)
pt2 = [p1.x + mu2 * (p2.x - p1.x), p1.y + mu2 * (p2.y - p1.y), p1.z + mu2 * (p2.z - p1.z)]

)

format “Intersections Point1: %, Point2: %\n” pt1 pt2
res = #(pt1,pt2)
res
)

 

version 1.0.0
Download

 

I found very useful to me use AkelPad editor as stand-alone editor for MaxScript files (.ms, .mcr).
Here the Coder plugin syntax file for AkelPad which contain proper syntax for .ms, .mcr files.

akelpad coder plugin syntax file

Download Version:0.2.2 (18.01.2011)

Upd: 

Download Version:0.2.3 (16.12.2011)

- 0.2.3 Updated for Coder plugin 8.0

 

It seems to me that I have found the solution how to back .max thumbs in windows 7 explorer.

.max thumbnails in windows 7 explorer

You need to add this code in the registry. Use included .reg file or code below.
Be sure you know what you are doing and create registry checkpoint. Of course to get it work you need restart your pc after have finished adding registry keys.


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.MAX]

[HKEY_CLASSES_ROOT\.MAX\PersistentHandler]
@="{98de59a0-d175-11cd-a7bd-00006b827d94}"

[HKEY_CLASSES_ROOT\SystemFileAssociations\.max]
"ExtendedTileInfo"="prop:System.ItemTypeText;System.Size;System.DateModified;System.Author;System.OfflineAvailability"
"FullDetails"="prop:System.PropGroup.Description;System.Title;System.Subject;System.Keywords;System.Category;System.Comment;System.PropGroup.Origin;System.Author;System.Document.LastAuthor;System.Document.RevisionNumber;System.Document.Version;System.ApplicationName;System.Company;System.Document.Manager;System.Document.DateCreated;System.Document.DateSaved;System.Document.DatePrinted;System.Document.TotalEditingTime;System.PropGroup.Content;System.ContentStatus;System.ContentType;System.Document.PageCount;System.Document.WordCount;System.Document.CharacterCount;System.Document.LineCount;System.Document.ParagraphCount;System.Document.Template;System.Document.Scale;System.Document.LinksDirty;System.Language;System.PropGroup.FileSystem;System.ItemNameDisplay;System.ItemTypeText;System.ItemFolderPathDisplay;System.DateCreated;System.DateModified;System.Size;System.FileAttributes;System.OfflineAvailability;System.OfflineStatus;System.SharedWith;System.FileOwner;System.ComputerName"
"InfoTip"="prop:System.ItemTypeText;System.Size;System.DateModified;System.Document.PageCount"
"PerceivedType"="document"
"PreviewDetails"="prop:*System.DateModified;System.Author;System.Keywords;*System.Size;System.Title;System.Comment;System.Category;*System.Document.PageCount;System.ContentStatus;System.ContentType;*System.OfflineAvailability;*System.OfflineStatus;System.Subject;*System.DateCreated;*System.SharedWith"
"ThumbnailCutoff"=dword:00000000

[HKEY_CLASSES_ROOT\SystemFileAssociations\.max\shellex]

[HKEY_CLASSES_ROOT\SystemFileAssociations\.max\shellex\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@="{9DBD2C50-62AD-11d0-B806-00C04FD706EC}"

[HKEY_CLASSES_ROOT\.max\PersistentHandler]
@="{98de59a0-d175-11cd-a7bd-00006b827d94}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Portable Devices\FormatMap\.max]
"Format"="{BA830000-AE6C-4804-98BA-C57B46965FE7}"
"ContentType"="{680ADF52-950A-4041-9B41-65E393648155}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\explorer\KindMap]
".max"="document"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\PropertySystem\PropertyHandlers\.max]
@="{97e467b4-98c6-4f19-9588-161b7773d6f6}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Portable Devices\FormatMap\.max]
"Format"="{BA830000-AE6C-4804-98BA-C57B46965FE7}"
"ContentType"="{680ADF52-950A-4041-9B41-65E393648155}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PropertySystem\PropertyHandlers\.max]
@="{97e467b4-98c6-4f19-9588-161b7773d6f6}"

But after you have added this code your thumbnails will not be stretched at full size. At this time I have found the only way to avoid it is remove 3dsmax.exe association with .max files. That’s not a good idea but it works.

To do this you need to find and remove key named something like this:

[HKEY_USERS\S-1-5-21-1697047998-497193070-276207954-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.max]

I’m looking forward to get this solution better…

Download .REG file

Originally posted at area.autodesk.com, please check this thread for more details

 

When you run 3ds max under Windows 7, Windows Media Player is used as default player for .avi files (when you play .avi files by using “View Animated Sequence File”). If you associate opening .avi files in Windows Explorer with another player (in my case “Media Player Classics – Home Cinema”) 3ds max all the same will play .avi files with WMP.

How to associate another player for playing .avi files in 3ds max?

1. Download “Default Programs Editor“, install and run.
2. Choose “File Type Settings”.

3. Choose “Context Menu”.

 

4. Enter .avi in search field, select .avi extension then press “next”.

 

5. Choose “Play with Windows Media Player” and press “Edit Selected Command”.

 

6. Set “Use Command line”, then browse your player, after this add “%L” parameter and press “next”.

 

 

7. Press “Save Context Menu”.

After all this has been done 3ds max will use your player for play .avi files with “View Animated Sequence File”.

© 2011 veda3d.com Suffusion theme by Sayontan Sinha