Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - plotting points on a curve element

Reply
 
Old 09-26-2008   #1 (permalink)
Marilyn


 
 

plotting points on a curve element

Hi: Graphic artists have long been told that they
have to take to Calculus to divide a bezier curve
into equidistant points. However I found it is
quite easy if you divide the curve into many
short straight lines ... Marilyn, math
student.


<HTML
xmlns:v="urn:schemas-microsoft-com:vml">
<HEAD><TITLE></TITLE><BASE>
<STYLE>
v\:* {
BEHAVIOR: url(#default#vml)
}
</STYLE>

<SCRIPT language=vbs defer>

sub window_onload()

set g=document.getelementsbytagname("group")(0)
set e=document.getelementsbytagname("curve")(0)

a=e.getattribute("from")
b=e.getattribute ("control1")
c=e.getattribute ("control2")
d=e.getattribute ("to")

aX=split(a,",")(0)
aY=split(a,",")(1)

bX=split(b,",")(0)
bY=split(b,",")(1)

cX=split(c,",")(0)
cY=split(c,",")(1)

dX=split(d,",")(0)
dY=split(d,",")(1)

for i=0 to 1 step .1
eX=aX + (bX-aX) * i
eY=aY + (bY-aY) * i

fX=bX + (cX-bX) * i
fY=bY + (cY-bY) * i

gX=cX + (dX-cX) * i
gY=cY + (dY-cY) * i

hX=eX + (fX-eX) * i
hY=eY + (fY-eY) * i

iX=fX + (gX-fX) * i
iY=fY + (gY-fY) * i

jX=hX + (iX-hX) * i
jY=hY + (iY-hY) * i

set e=document.createelement("v:line")
g.insertbefore e,null
e.setattribute "to",jX & "," & jY
e.setattribute "from","1000,0"

next
end sub
</SCRIPT>
</HEAD>
<BODY>
<?xml:namespace prefix = v
ns = "urn:schemas-microsoft-com:vml" />

<v:group style="LEFT: 0px; WIDTH: 100px;
POSITION: absolute; TOP: 0px; HEIGHT: 100px;
BACKGROUND-COLOR: #ffffff"
coordsize = "500,500">

<v:curve from = "625,1385" control1 =
"905,990"
control2 = "1310,1390" to = "1755,1375"
strokeweight = "1.5pt">
</v:curve>

</v:group>




</body>
</html>




My System SpecsSystem Spec
Old 09-27-2008   #2 (permalink)
Paul Randall


 
 

Re: plotting points on a curve element


"Marilyn" <mar@xxxxxx> wrote in message
news:eK6%23gSFIJHA.4600@xxxxxx
Quote:

> Hi: Graphic artists have long been told that they
> have to take to Calculus to divide a bezier curve
> into equidistant points. However I found it is
> quite easy if you divide the curve into many
> short straight lines ... Marilyn, math student.
>
>
> <HTML xmlns:v="urn:schemas-microsoft-com:vml">
> <HEAD><TITLE></TITLE><BASE>
> <STYLE>
> v\:* {
> BEHAVIOR: url(#default#vml)
> }
> </STYLE>
>
> <SCRIPT language=vbs defer>
>
> sub window_onload()
>
> set g=document.getelementsbytagname("group")(0)
> set e=document.getelementsbytagname("curve")(0)
>
> a=e.getattribute("from")
> b=e.getattribute ("control1")
> c=e.getattribute ("control2")
> d=e.getattribute ("to")
>
> aX=split(a,",")(0)
> aY=split(a,",")(1)
>
> bX=split(b,",")(0)
> bY=split(b,",")(1)
>
> cX=split(c,",")(0)
> cY=split(c,",")(1)
>
> dX=split(d,",")(0)
> dY=split(d,",")(1)
>
> for i=0 to 1 step .1
> eX=aX + (bX-aX) * i
> eY=aY + (bY-aY) * i
>
> fX=bX + (cX-bX) * i
> fY=bY + (cY-bY) * i
>
> gX=cX + (dX-cX) * i
> gY=cY + (dY-cY) * i
>
> hX=eX + (fX-eX) * i
> hY=eY + (fY-eY) * i
>
> iX=fX + (gX-fX) * i
> iY=fY + (gY-fY) * i
>
> jX=hX + (iX-hX) * i
> jY=hY + (iY-hY) * i
>
> set e=document.createelement("v:line")
> g.insertbefore e,null
> e.setattribute "to",jX & "," & jY
> e.setattribute "from","1000,0"
>
> next
> end sub
> </SCRIPT>
> </HEAD>
> <BODY>
> <?xml:namespace prefix = v
> ns = "urn:schemas-microsoft-com:vml" />
>
> <v:group style="LEFT: 0px; WIDTH: 100px;
> POSITION: absolute; TOP: 0px; HEIGHT: 100px; BACKGROUND-COLOR: #ffffff"
> coordsize = "500,500">
>
> <v:curve from = "625,1385" control1 = "905,990"
> control2 = "1310,1390" to = "1755,1375" strokeweight = "1.5pt">
> </v:curve>
>
> </v:group>
>
>
>
>
> </body>
> </html>
VML is a cute toy but it is a security risk.
http://www.pcauthority.com.au/News/6...l-exploit.aspx

-Paul Randall


My System SpecsSystem Spec
Old 09-27-2008   #3 (permalink)
Marilyn


 
 

Re: plotting points on a curve element

Anything that comes from the sensationalistic
Australian News Media can be filed under garbage.
Marilyn



Quote:
Quote:

>>"Paul Randall" wrote etc.
My System SpecsSystem Spec
Old 09-27-2008   #4 (permalink)
Paul Randall


 
 

Re: plotting points on a curve element


"Marilyn" <mar@xxxxxx> wrote in message
news:OQBTaRLIJHA.4600@xxxxxx
Quote:

> Anything that comes from the sensationalistic Australian News Media can be
> filed under garbage. Marilyn

Since VML has been around so long and is used so little, perhaps there were
some grains of truth hidden in the garbage. Google for VML info at
msdn.microsoft.com and groups.google.com and for books about VML. I think
you will find that VML is not used much because of its potential as a
security hole.

-Paul Randall


My System SpecsSystem Spec
Old 09-27-2008   #5 (permalink)
Marilyn


 
 

Re: plotting points on a curve element


"Paul Randall" <paulr90@xxxxxx> wrote in message
news:uZXx1nLIJHA.1160@xxxxxx
Quote:

>
> "Marilyn" <mar@xxxxxx> wrote in message
> news:OQBTaRLIJHA.4600@xxxxxx
Quote:

>> Anything that comes from the sensationalistic
>> Australian News Media can be filed under garbage.
>> Marilyn
>
>
> Since VML has been around so long and is used so
> little, perhaps there were some grains of truth
> hidden in the garbage. Google for VML info at
> msdn.microsoft.com and groups.google.com and for
> books about VML. I think you will find that VML is
> not used much because of its potential as a
> security hole.
>
> -Paul Randall
>
What I found when I googled was that all the holes
had been plugged years ago .. unless you don't
update? M.

My System SpecsSystem Spec
Old 09-27-2008   #6 (permalink)
Marilyn


 
 

Re: plotting points on a curve element

As for VML not being used. Did you ever look up a
place in Google Maps or Google Earth. How do you
think all those lines are drawn .. none other than
Microsoft's Vector Markup Language. Marilyn

My System SpecsSystem Spec
Old 09-28-2008   #7 (permalink)
Paul Randall


 
 

Re: plotting points on a curve element


"Marilyn" <mar@xxxxxx> wrote in message
news:%23N6qftOIJHA.2208@xxxxxx
Quote:

> As for VML not being used. Did you ever look up a place in Google Maps or
> Google Earth. How do you think all those lines are drawn .. none other
> than Microsoft's Vector Markup Language. Marilyn
You may be right about its security holes being fixed and its being widely
used.
The last time I played with it was with examples like those posted in this
newsgroup with the title 'VML or Autocad'. I see that there is pretty good
documentation at
http://msdn.microsoft.com/en-us/libr...80(VS.85).aspx. I will play
with it when I get a chance.

If you have any links to more working VML example scripts, please post them.

-Paul Randall


My System SpecsSystem Spec
Old 09-28-2008   #8 (permalink)
mayayana


 
 

Re: plotting points on a curve element

> Since VML has been around so long and is used so little, perhaps there
were
Quote:

> some grains of truth hidden in the garbage. Google for VML info at
> msdn.microsoft.com and groups.google.com and for books about VML. I think
> you will find that VML is not used much because of its potential as a
> security hole.
>
Or maybe it's not used much because it's so much work
with few applications. The curve code is interesting, but
it's *a lot* of code just to make a curve. It's hard to
imagine where I might use such a thing. And this code
only works in IE....and it requires enabling javascript...
so it's not very useful online.


My System SpecsSystem Spec
Old 09-28-2008   #9 (permalink)
Marilyn


 
 

Re: plotting points on a curve element


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:e$Mm$abIJHA.4836@xxxxxx
Quote:
Quote:

>> Since VML has been around so long and is used so
>> little, perhaps there
> were
Quote:

>> some grains of truth hidden in the garbage.
>> Google for VML info at
>> msdn.microsoft.com and groups.google.com and for
>> books about VML. I think
>> you will find that VML is not used much because of
>> its potential as a
>> security hole.
>>
>
> Or maybe it's not used much because it's so much
> work
> with few applications. The curve code is
> interesting, but
> it's *a lot* of code just to make a curve. It's
> hard to
> imagine where I might use such a thing. And this
> code
> only works in IE....and it requires enabling
> javascript...
> so it's not very useful online.
>
>
Hi Mayayana:

Do you realize that there are millions of
mathematicians and graphic artists out there who have
been beating there brains out for years trying to
figure out how to divide a bezier curve into equal
pieces. If you think you can do it without my script
go ahead .. and send the results. We're talking here
about points on the computer screen on an X and Y
axis. For instance a straight line could start at 10X
and 10Y. That's 10 pixels to the right and 10 down.
And it could end at 110X and 110Y. Now to divide that
into equal parts you only have to subtract the end
point from the start point on both axis and divide
each by how many pieces you want. For instance
dividing in half would be 50 across and 50 down. Now
a little bit of thought will tell you that you can't
do that with a curve. That's what my script does.

You say you don't have Javascript enabled on your
computer? Well as far as I understand it then there
isn't a web page that's going to display correctly on
your computer if this is so.

Another thing on VML. It seems a lot of people in
cyberland have the wrong idea about VML. It's purpose
isn't to send VML code through the Internet. It's
only to be used to create the objects that you are
working on at your own computer.. a graph, a picture,
a map, etc. Then you make a screen capture of your
creation and send that over the Internet .. not the
VML HTML page. I only sent it here because I though
you guys were operating at a little higher state of
knowledge. Sure guessed wrong. You're actually just a
bunch of backroom boys stuck in the past in a smoky
lounge room afraid to even look at the future.

Marilyn

My System SpecsSystem Spec
Old 09-29-2008   #10 (permalink)
Steve


 
 

Re: plotting points on a curve element

Marilyn wrote:
Quote:

>
> You say you don't have Javascript enabled on your
> computer? Well as far as I understand it then there
> isn't a web page that's going to display correctly on
> your computer if this is so.
>
Your understanding is flawed. A web page that relies on JavaScript to
display correctly is poorly designed. Many people have scritping
disabled in their *browser* (not on their computer). Scripting on web
pages should only be used to enhance the page; it should not be
necessary to view the page!

I certainly don't have scripting enabled by default in my browser. If
pages don't display "correctly", I don't care as long as I can find the
information I need. If a site needs scripting enabled to display at all,
I just move on. If there is a site that I must visit and it needs
scripting enabled (there are very few of these), I adjust the browser
*for that site only*. Opera has built-in site preferrences that include
scripting, Java and plug-ins. Firefox has plug-ins that allow the same
control. IE allows you to disable scripting (and other options) in the
Internet Zone and add sites that need scripting to the Trusted zone.

--
Steve

A teacher who is attempting to teach, without inspiring the pupil with a
desire to learn, is hammering on a cold iron. -Horace Mann


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Live and Blackberry Curve Live Mail
Blackberry Curve Live Mail
Blackberry Curve Vista General
Vista Learning Curve Vista General
MS Vista learning curve Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46