ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Has anybody used asymptote without LaTeX?
@ 2008-09-28  2:35 Zhichu Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Zhichu Chen @ 2008-09-28  2:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

It is said that Asymptote has supported PRC format 3D file:
http://asymptote.sourceforge.net/gallery/3D%20graphs/

I really wanna give it a try, but once I was building from the svn
source, I was told that I don't have LaTeX in my $PATH. I haven't
really been using LaTeX for a long time, and I prefer I don't need
to install a bunch of LaTeX programs and packages just for a
drawing program which, IMHO, only use LaTeX to make nice
labels.

Is there any workarounds? And how to embed .prc files into
the .pdf document?


-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-10-11  5:25             ` Michail Vidiassov
@ 2008-10-11 12:02               ` Zhichu Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Zhichu Chen @ 2008-10-11 12:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

On Sat, Oct 11, 2008 at 1:25 PM, Michail Vidiassov <master@iaas.msu.ru> wrote:
> Dear All,
>
> On Fri, 10 Oct 2008, Zhichu Chen wrote:
>
>> If I want to embed the .prc file into a pdf document, all I need to do
>> is specify the correct /Subtype and mime type. That's very easy. I
>> think creating 3D presentations without any commercial or mouse-
>> clicking-GUI interface becomes realistic now.
>
> No, there is more - you have to set appearance (may be empty).
> And many nice things can be done via properties of the 3D object embedded
> into PDF. Consult latest PDF reference.

Oh, yea, I don't know that, no wonder my output doesn't look good.

> You may look at libharu U3D code (it handles PRC too) and my
> embedder (it needs libconfig from http://www.hyperrealm.com/libconfig/
> and libharu from libharu.org) from
> http://www.iaas.msu.ru/tmp/u3dembedder.tgz
Thanks, I'll study on that.
>
>   Sincerely, Michail
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-10-10  2:48           ` Zhichu Chen
@ 2008-10-11  5:25             ` Michail Vidiassov
  2008-10-11 12:02               ` Zhichu Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Michail Vidiassov @ 2008-10-11  5:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear All,

On Fri, 10 Oct 2008, Zhichu Chen wrote:

> If I want to embed the .prc file into a pdf document, all I need to do
> is specify the correct /Subtype and mime type. That's very easy. I
> think creating 3D presentations without any commercial or mouse-
> clicking-GUI interface becomes realistic now.

No, there is more - you have to set appearance (may be empty).
And many nice things can be done via properties of the 3D object embedded 
into PDF. Consult latest PDF reference.
You may look at libharu U3D code (it handles PRC too) and my 
embedder (it needs libconfig from http://www.hyperrealm.com/libconfig/
and libharu from libharu.org) from
http://www.iaas.msu.ru/tmp/u3dembedder.tgz

   Sincerely, Michail

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-10-08 16:49         ` Zhichu Chen
@ 2008-10-10  2:48           ` Zhichu Chen
  2008-10-11  5:25             ` Michail Vidiassov
  0 siblings, 1 reply; 10+ messages in thread
From: Zhichu Chen @ 2008-10-10  2:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, all,

It's me again. Since Asymptote 1.44 has been released, I don't have
to compile it myself. So I played a little bit and find out that if I don't
want labels nor produce a pdf format of that image, I can live without
LaTeX. That's kind of a good news.

If I want to embed the .prc file into a pdf document, all I need to do
is specify the correct /Subtype and mime type. That's very easy. I
think creating 3D presentations without any commercial or mouse-
clicking-GUI interface becomes realistic now.


-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-09-29 17:19       ` Michail Vidiassov
@ 2008-10-08 16:49         ` Zhichu Chen
  2008-10-10  2:48           ` Zhichu Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Zhichu Chen @ 2008-10-08 16:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Michail,

It's a little late for me to check my mailbox. Thank you for your work
and yes, I'm
interested in it. Can I get a copy of it?

On Mon, Sep 29, 2008 at 5:19 PM, Michail Vidiassov <master@iaas.msu.ru> wrote:
> Dear All,
>
>>>>> And how to embed .prc files into the .pdf document?
>
> I have made a standalone embedder some time ago,
> reproducing capabilities of movie15 LeTeX package and somewhat extending them.
> If anybody is interested it can be put in "shipable" state.
>
>                Sincerely, Michail
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-09-29  5:57     ` Yue Wang
  2008-09-29 12:09       ` Zhichu Chen
@ 2008-09-29 17:19       ` Michail Vidiassov
  2008-10-08 16:49         ` Zhichu Chen
  1 sibling, 1 reply; 10+ messages in thread
From: Michail Vidiassov @ 2008-09-29 17:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear All,

>>>> And how to embed .prc files into the .pdf document?

I have made a standalone embedder some time ago,
reproducing capabilities of movie15 LeTeX package and somewhat extending them.
If anybody is interested it can be put in "shipable" state.

                Sincerely, Michail

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-09-29  5:57     ` Yue Wang
@ 2008-09-29 12:09       ` Zhichu Chen
  2008-09-29 17:19       ` Michail Vidiassov
  1 sibling, 0 replies; 10+ messages in thread
From: Zhichu Chen @ 2008-09-29 12:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Yue,

On Mon, Sep 29, 2008 at 1:57 PM, Yue Wang <yuleopen@gmail.com> wrote:
> Hi, Zhichu:
>
> $n$ years ago ($n\geq 2$), some user had successfully embed a u3d
> format file into pdf using ConTeXt with the instruction from Hans. I
> think the module is still there. Maybe you can have a look. In fact
> u3d and prc are similar, maybe you can try the same way. But I have no
> idea how to create a asy-tex interface like tex-mp [Moreover, I prefer
> to extend mp to 3-dimension, I look at the c code, it is not
> impossible:)].
Yes, I know that Renaud Aubin has u3d usable by ConTeXt. That's very
impressive. I will check that if I can get Asymptote compiled and work
with ConTeXt, although I don't think that necessary because labeled figures
often appears in 2D version.

If metapost could provide 3D figures, that will be great. But I don't think
Hans and Taco like that idea because prc isn't a standard yet maybe.
>
> Yue Wang
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-09-29  5:17   ` Zhichu Chen
@ 2008-09-29  5:57     ` Yue Wang
  2008-09-29 12:09       ` Zhichu Chen
  2008-09-29 17:19       ` Michail Vidiassov
  0 siblings, 2 replies; 10+ messages in thread
From: Yue Wang @ 2008-09-29  5:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, Zhichu:

$n$ years ago ($n\geq 2$), some user had successfully embed a u3d
format file into pdf using ConTeXt with the instruction from Hans. I
think the module is still there. Maybe you can have a look. In fact
u3d and prc are similar, maybe you can try the same way. But I have no
idea how to create a asy-tex interface like tex-mp [Moreover, I prefer
to extend mp to 3-dimension, I look at the c code, it is not
impossible:)].

Yue Wang

On Mon, Sep 29, 2008 at 1:17 PM, Zhichu Chen <zhichu.chen@gmail.com> wrote:
> Hi, Alan
>
> Thank you for your attention, but I don't need the psedu-3D effect. Asymptote
> could create real 3D file which pdf has supported since, maybe, version 1.5.
>
>
>
> On Sun, Sep 28, 2008 at 10:19 PM, Alan BRASLAU <alan.braslau@cea.fr> wrote:
>> On 2008-09-28 04:35 Zhichu Chen wrote:
>>> It is said that Asymptote has supported PRC format 3D file:
>>> http://asymptote.sourceforge.net/gallery/3D%20graphs/
>>>
>>> I really wanna give it a try, but once I was building from the svn
>>> source, I was told that I don't have LaTeX in my $PATH. I haven't
>>> really been using LaTeX for a long time, and I prefer I don't need
>>> to install a bunch of LaTeX programs and packages just for a
>>> drawing program which, IMHO, only use LaTeX to make nice
>>> labels.
>>>
>>> Is there any workarounds? And how to embed .prc files into
>>> the .pdf document?
>>>  --
>>> Best Regards
>>> Chen
>>
>> This doesn't really answer your question
>> but may be of some related interest to the mailing list.
>>
>> I am quite fond of pfg/tikz as a drawing package
>> that works rather well with plain tex, latex and context.
>> Asymptote is a similar tool, but it seems to be less portable.
>> However, it appears on the other hand to be much more powerful for 3D.
>> Neverless, I am sharing with this context list an impressive tikz example
>>
>>
>>
>>
>>
>> --
>> Alan Braslau
>> CEA DSM-IRAMIS-SPEC
>> CNRS URA 2464
>> Orme des Merisiers
>> 91191 Gif-sur-Yvette cedex FRANCE
>> tel: +33 1 69 08 73 15
>> fax: +33 1 69 08 87 86
>> mailto:alan.braslau@cea.fr
>>
>> http://www-dna2006.cea.fr/
>>
>>  .''`.
>> : :'  :
>> `. `'`
>>  `-
>> that I have adapted to context. (I have put the author on copy.)
>>
>> Basically, the only changes to the latex source are
>> \usepackage{preview} -> \startTEXpage \stopTEXpage
>> \begin{tikzpicture} -> \starttikzpicture
>> and a few other minor syntax adaptations...)
>>
>> Alan
>>
>> % What is it
>> % ==========
>> %
>> % Examples inspired by the thread at comp.text.tex about how to convert some
>> hand
>> % drawn pictures into programmatic 3D sketches:
>> %
>> http://groups.google.com/group/comp.text.tex/browse_thread/thread/a03baf5d6fa64865/f7e7b903f1d87a6a
>> % The sketches present stereographic and cylindrical map projections and they
>> % pose some interesting challenges for doing them with a 2D drawing package
>> PGF/TikZ.
>> %
>> % The main idea is to draw in selected 3D planes and then project onto the
>> canvas
>> % coordinate system with an appriopriate transformation. Some highlights:
>> % [*] usage of pgf math engine for calculation of projection transformations
>> and
>> %     transitions points from visible (solid lines) to invisible (dashed
>> lines) on
>> %     meridians and latitude circles
>> % [*] definition of 3D plane transformation with expanded styles so that they
>> are robust
>> %     against redefinition of macros used in their construction
>> % [*] usage of named coordinates (nodes) for definition of characteristic
>> points in
>> %     local coordinate systems so that they are accessible outside of their
>> plane of
>> %     definition
>> % [*] calculation of intersections points with TikZ intersection coordinate
>> system
>> % [*] usage of 'to' path operation instead of 'arc' for marking angles to
>> allow for
>> %     easy positioning of text labels on the curve
>> % [*] 3D lighting effects with shading
>> %
>> %
>> % Who's done it
>> % =============
>> %
>> % Tomasz M. Trzeciak
>> %
>> %
>> % Distribution and use
>> % ====================
>> %
>> % Use as you see fit. Consider giving a proper attribution to the author.
>> %
>> %
>> % Change log
>> % ==========
>> %
>> % 2008/08/07  posted to latex-community.org
>> % 2008/08/08  fixed some typos, added note about 'to' path operation to the
>> description,
>> %             fixed positioning issue of nodes and 'to' path operation as
>> suggested
>> %             by Kjell, removed some dead code from KART picture
>> % 2008/09/28  adapted as an example to ConTeXt
>>
>> \usemodule[tikz]
>> \usetikzlibrary[calc,fadings,decorations.pathreplacing]
>>
>> %% helper macros
>>
>> \def\pgfmathsinandcos#1#2#3{%
>>  \pgfmathsetmacro#1{sin(#3)}%
>>  \pgfmathsetmacro#2{cos(#3)}%
>> }
>> \def\LongitudePlane#1#2#3{%
>>  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
>>  \pgfmathsinandcos\sint\cost{#3} % azimuth
>>  \tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
>> }
>> \def\LatitudePlane#1#2#3{%
>>  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
>>  \pgfmathsinandcos\sint\cost{#3} % latitude
>>  \pgfmathsetmacro\yshift{\cosEl*\sint}
>>  \tikzset{#1/.estyle={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
>> }
>> \def\DrawLongitudeCircle#1#2{
>>  \LongitudePlane{current plane}{\angEl}{#2}
>>  \tikzset{current plane/.prefix style={scale=#1}}
>>   % angle of "visibility"
>>  \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
>>  \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
>>  \draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
>> }
>> \def\DrawLatitudeCircle#1#2{
>>  \LatitudePlane{current plane}{\angEl}{#2}
>>  \tikzset{current plane/.prefix style={scale=#1}}
>>  \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
>>  % angle of "visibility"
>>  \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
>>  \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
>>  \draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
>> }
>>
>> %% document-wide tikz options and styles
>>
>> \tikzset{%
>>  >=latex, % option for nice arrows
>>  inner sep=0pt,%
>>  outer sep=2pt,%
>>  mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum
>> size=3pt,fill=black,circle}%
>> }
>>
>> \starttext
>>
>> \startTEXpage
>> \starttikzpicture % "THE GLOBE" showcase
>>
>> \def\R{2.5} % sphere radius
>> \def\angEl{35} % elevation angle
>> \filldraw[ball color=white] (0,0) circle (\R);
>> \foreach \t in {-80,-60,...,80} { \DrawLatitudeCircle{\R}{\t} }
>> \foreach \t in {-5,-35,...,-175} { \DrawLongitudeCircle{\R}{\t} }
>> % some fancy transparent shading
>> % \tikzfading[name=fade inside,inner color=transparent!80,outer
>> color=transparent!30]
>> % \shadedraw[ball color=white,path fading=fade inside] (0,0) circle (\R);
>>
>> \stoptikzpicture
>> \stopTEXpage
>>
>> \startTEXpage
>> \starttikzpicture % CENT
>>
>> %% some definitions
>>
>> \def\R{2.5} % sphere radius
>> \def\angEl{35} % elevation angle
>> \def\angAz{-105} % azimuth angle
>> \def\angPhi{-40} % longitude of point P
>> \def\angBeta{19} % latitude of point P
>>
>> %% working planes
>>
>> \pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
>> \tikzset{xyplane/.estyle={cm={cos(\angAz),sin(\angAz)*sin(\angEl),-
>> sin(\angAz),cos(\angAz)*sin(\angEl),(0,-\H)}}}
>> \LongitudePlane{xzplane}{\angEl}{\angAz}
>> \LongitudePlane{pzplane}{\angEl}{\angPhi}
>> \LatitudePlane{equator}{\angEl}{0}
>>
>> %% draw xyplane and sphere
>>
>> \draw[xyplane] (-2*\R,-2*\R) rectangle (2.2*\R,2.8*\R);
>> \fill[ball color=white] (0,0) circle (\R); % 3D lighting effect
>> %\fill[white] (0,0) circle (\R); % just a white circle
>> \draw (0,0) circle (\R);
>>
>> %% characteristic points
>>
>> \coordinate (O) at (0,0);
>> \coordinate[mark coordinate] (N) at (0,\H);
>> \coordinate[mark coordinate] (S) at (0,-\H);
>> \path[pzplane] (\angBeta:\R) coordinate[mark coordinate] (P);
>> \path[pzplane] (\R,0) coordinate (PE);
>> \path[xzplane] (\R,0) coordinate (XE);
>> \path (PE) ++(0,-\H) coordinate (Paux); % to aid Phat calculation
>> \coordinate[mark coordinate] (Phat) at (intersection cs: first line={(N)--(P)},
>> second line={(S)--(Paux)});
>>
>> %% draw meridians and latitude circles
>>
>> \DrawLatitudeCircle{\R}{0} % equator
>> %\DrawLatitudeCircle{\R}{\angBeta}
>> \DrawLongitudeCircle{\R}{\angAz} % xzplane
>> \DrawLongitudeCircle{\R}{\angAz+90} % yzplane
>> \DrawLongitudeCircle{\R}{\angPhi} % pzplane
>>
>> %% draw xyz coordinate system
>>
>> \draw[xyplane,<->] (1.8*\R,0) node[below] {$x,\xi$} -- (0,0) -- (0,2.4*\R)
>> node[right] {$y,\eta$};
>> \draw[->] (0,-\H) -- (0,1.6*\R) node[above] {$z,\zeta$};
>>
>> %% draw lines and put labels
>>
>> \draw[dashed] (P) -- (N) +(0.3ex,0.6ex) node[above left] {\bf $N$};
>> \draw (P) -- (Phat) node[above right] {\bf $\hat{P}$};
>> \path (S) +(0.4ex,-0.4ex) node[below] {\bf $S$};
>> \draw[->] (O) -- (P) node[above right] {\bf $P$};
>> \draw[dashed] (XE) -- (O) -- (PE);
>> \draw[pzplane,->,thin] (0:0.5*\R) to[bend right=15] node[pos=0.4,right]
>> {$\beta$} (\angBeta:0.5*\R);
>> \draw[equator,->,thin] (\angAz:0.4*\R) to[bend right=30] node[pos=0.4,below]
>> {$\phi$} (\angPhi:0.4*\R);
>> \draw[thin,decorate,decoration={brace,raise=0.5pt,amplitude=1ex}] (N) -- (O)
>> node[midway,right=1ex] {$a$};
>>
>> \stoptikzpicture
>> \stopTEXpage
>>
>> \startTEXpage
>> \starttikzpicture % MERC
>>
>> %% some definitions
>>
>> \def\R{3} % sphere radius
>> \def\angEl{25} % elevation angle
>> \def\angAz{-100} % azimuth angle
>> \def\angPhiOne{-50} % longitude of point P
>> \def\angPhiTwo{-35} % longitude of point Q
>> \def\angBeta{33} % latitude of point P and Q
>>
>> %% working planes
>>
>> \pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
>> \LongitudePlane{xzplane}{\angEl}{\angAz}
>> \LongitudePlane{pzplane}{\angEl}{\angPhiOne}
>> \LongitudePlane{qzplane}{\angEl}{\angPhiTwo}
>> \LatitudePlane{equator}{\angEl}{0}
>>
>> %% draw background sphere
>>
>> \fill[ball color=white] (0,0) circle (\R); % 3D lighting effect
>> %\fill[white] (0,0) circle (\R); % just a white circle
>> \draw (0,0) circle (\R);
>>
>> %% characteristic points
>>
>> \coordinate (O) at (0,0);
>> \coordinate[mark coordinate] (N) at (0,\H);
>> \coordinate[mark coordinate] (S) at (0,-\H);
>> \path[xzplane] (\R,0) coordinate (XE);
>> \path[pzplane] (\angBeta:\R) coordinate (P);
>> \path[pzplane] (\R,0) coordinate (PE);
>> \path[qzplane] (\angBeta:\R) coordinate (Q);
>> \path[qzplane] (\R,0) coordinate (QE);
>>
>> %% meridians and latitude circles
>>
>> % \DrawLongitudeCircle{\R}{\angAz} % xzplane
>> % \DrawLongitudeCircle{\R}{\angAz+90} % yzplane
>> \DrawLongitudeCircle{\R}{\angPhiOne} % pzplane
>> \DrawLongitudeCircle{\R}{\angPhiTwo} % qzplane
>> \DrawLatitudeCircle{\R}{\angBeta}
>> \DrawLatitudeCircle{\R}{0} % equator
>> % shifted equator in node with nested call to tikz (I didn't know it's
>> possible)
>> \node at (0,1.6*\R) { \tikz{\DrawLatitudeCircle{\R}{0}} };
>>
>> %% draw lines and put labels
>>
>> \draw (-\R,-\H) -- (-\R,2*\R) (\R,-\H) -- (\R,2*\R);
>> \draw[->] (XE) -- +(0,2*\R) node[above] {$y$};
>> \node[above=8pt] at (N) {\bf $N$};
>> \node[below=8pt] at (S) {\bf $S$};
>> \draw[->] (O) -- (P);
>> \draw[dashed] (XE) -- (O) -- (PE);
>> \draw[dashed] (O) -- (QE);
>> \draw[pzplane,->,thin] (0:0.5*\R) to[bend right=15] node[midway,right]
>> {$\beta$} (\angBeta:0.5*\R);
>> \path[pzplane] (0.5*\angBeta:\R) node[right] {$\hat{1}$};
>> \path[qzplane] (0.5*\angBeta:\R) node[right] {$\hat{2}$};
>> \draw[equator,->,thin] (\angAz:0.5*\R) to[bend right=30] node[pos=0.4,above]
>> {$\phi_1$} (\angPhiOne:0.5*\R);
>> \draw[equator,->,thin] (\angAz:0.6*\R) to[bend right=35] node[midway,below]
>> {$\phi_2$} (\angPhiTwo:0.6*\R);
>> \draw[equator,->] (-90:\R) arc (-90:-70:\R) node[below=0.3ex] {$x = a\phi$};
>> \path[xzplane] (0:\R) node[below] {$\beta=0$};
>> \path[xzplane] (\angBeta:\R) node[below left] {$\beta=\beta_0$};
>>
>> \stoptikzpicture
>> \stopTEXpage
>>
>> \startTEXpage
>> \starttikzpicture % KART
>>
>> \def\R{2.5}
>>
>> \node[draw,minimum size=2cm*\R,inner sep=0,outer sep=0,circle] (C) at (0,0)
>> {};
>> \coordinate (O) at (0,0);
>> \coordinate[mark coordinate] (Phat) at (20:2.5*\R);
>> \coordinate (T1) at (tangent cs: node=C, point={(Phat)}, solution=1);
>> \coordinate (T2) at (tangent cs: node=C, point={(Phat)}, solution=2);
>> \coordinate[mark coordinate] (P) at ($(T1)!0.5!(T2)$);
>>
>> \draw[dashed] (T1) -- (O) -- (T2) -- (Phat) -- (T1) -- (T2);
>> \draw[->] (-1.5*\R,0) -- (2.5*\R,0) node[right] {$x$};
>> \draw[->] (0,-1.5*\R) -- (0,1.5*\R) node[above] {$y$};
>> \draw (O) node[below left] {\bf $O$} -- (P) +(1ex,0) node[above=1ex] {\bf
>> $P$};
>> \draw (P) -- (Phat) node[above=1ex] {\bf $\hat{P}$};
>>
>> \stoptikzpicture
>> \stopTEXpage
>>
>> \stoptext
>>
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to the Wiki!
>>
>> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
>> archive  : https://foundry.supelec.fr/projects/contextrev/
>> wiki     : http://contextgarden.net
>> ___________________________________________________________________________________
>>
>
>
>
> --
> Best Regards
> Chen
> ----------------------------------------------------------------
>
>          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
>         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
>             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
>                                               | www.sinap.ac.cn
> ----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-09-28 14:19 ` Has anybody used asymptote without LaTeX? Alan BRASLAU
@ 2008-09-29  5:17   ` Zhichu Chen
  2008-09-29  5:57     ` Yue Wang
  0 siblings, 1 reply; 10+ messages in thread
From: Zhichu Chen @ 2008-09-29  5:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, Alan

Thank you for your attention, but I don't need the psedu-3D effect. Asymptote
could create real 3D file which pdf has supported since, maybe, version 1.5.



On Sun, Sep 28, 2008 at 10:19 PM, Alan BRASLAU <alan.braslau@cea.fr> wrote:
> On 2008-09-28 04:35 Zhichu Chen wrote:
>> It is said that Asymptote has supported PRC format 3D file:
>> http://asymptote.sourceforge.net/gallery/3D%20graphs/
>>
>> I really wanna give it a try, but once I was building from the svn
>> source, I was told that I don't have LaTeX in my $PATH. I haven't
>> really been using LaTeX for a long time, and I prefer I don't need
>> to install a bunch of LaTeX programs and packages just for a
>> drawing program which, IMHO, only use LaTeX to make nice
>> labels.
>>
>> Is there any workarounds? And how to embed .prc files into
>> the .pdf document?
>>  --
>> Best Regards
>> Chen
>
> This doesn't really answer your question
> but may be of some related interest to the mailing list.
>
> I am quite fond of pfg/tikz as a drawing package
> that works rather well with plain tex, latex and context.
> Asymptote is a similar tool, but it seems to be less portable.
> However, it appears on the other hand to be much more powerful for 3D.
> Neverless, I am sharing with this context list an impressive tikz example
>
>
>
>
>
> --
> Alan Braslau
> CEA DSM-IRAMIS-SPEC
> CNRS URA 2464
> Orme des Merisiers
> 91191 Gif-sur-Yvette cedex FRANCE
> tel: +33 1 69 08 73 15
> fax: +33 1 69 08 87 86
> mailto:alan.braslau@cea.fr
>
> http://www-dna2006.cea.fr/
>
>  .''`.
> : :'  :
> `. `'`
>  `-
> that I have adapted to context. (I have put the author on copy.)
>
> Basically, the only changes to the latex source are
> \usepackage{preview} -> \startTEXpage \stopTEXpage
> \begin{tikzpicture} -> \starttikzpicture
> and a few other minor syntax adaptations...)
>
> Alan
>
> % What is it
> % ==========
> %
> % Examples inspired by the thread at comp.text.tex about how to convert some
> hand
> % drawn pictures into programmatic 3D sketches:
> %
> http://groups.google.com/group/comp.text.tex/browse_thread/thread/a03baf5d6fa64865/f7e7b903f1d87a6a
> % The sketches present stereographic and cylindrical map projections and they
> % pose some interesting challenges for doing them with a 2D drawing package
> PGF/TikZ.
> %
> % The main idea is to draw in selected 3D planes and then project onto the
> canvas
> % coordinate system with an appriopriate transformation. Some highlights:
> % [*] usage of pgf math engine for calculation of projection transformations
> and
> %     transitions points from visible (solid lines) to invisible (dashed
> lines) on
> %     meridians and latitude circles
> % [*] definition of 3D plane transformation with expanded styles so that they
> are robust
> %     against redefinition of macros used in their construction
> % [*] usage of named coordinates (nodes) for definition of characteristic
> points in
> %     local coordinate systems so that they are accessible outside of their
> plane of
> %     definition
> % [*] calculation of intersections points with TikZ intersection coordinate
> system
> % [*] usage of 'to' path operation instead of 'arc' for marking angles to
> allow for
> %     easy positioning of text labels on the curve
> % [*] 3D lighting effects with shading
> %
> %
> % Who's done it
> % =============
> %
> % Tomasz M. Trzeciak
> %
> %
> % Distribution and use
> % ====================
> %
> % Use as you see fit. Consider giving a proper attribution to the author.
> %
> %
> % Change log
> % ==========
> %
> % 2008/08/07  posted to latex-community.org
> % 2008/08/08  fixed some typos, added note about 'to' path operation to the
> description,
> %             fixed positioning issue of nodes and 'to' path operation as
> suggested
> %             by Kjell, removed some dead code from KART picture
> % 2008/09/28  adapted as an example to ConTeXt
>
> \usemodule[tikz]
> \usetikzlibrary[calc,fadings,decorations.pathreplacing]
>
> %% helper macros
>
> \def\pgfmathsinandcos#1#2#3{%
>  \pgfmathsetmacro#1{sin(#3)}%
>  \pgfmathsetmacro#2{cos(#3)}%
> }
> \def\LongitudePlane#1#2#3{%
>  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
>  \pgfmathsinandcos\sint\cost{#3} % azimuth
>  \tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
> }
> \def\LatitudePlane#1#2#3{%
>  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
>  \pgfmathsinandcos\sint\cost{#3} % latitude
>  \pgfmathsetmacro\yshift{\cosEl*\sint}
>  \tikzset{#1/.estyle={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
> }
> \def\DrawLongitudeCircle#1#2{
>  \LongitudePlane{current plane}{\angEl}{#2}
>  \tikzset{current plane/.prefix style={scale=#1}}
>   % angle of "visibility"
>  \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
>  \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
>  \draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
> }
> \def\DrawLatitudeCircle#1#2{
>  \LatitudePlane{current plane}{\angEl}{#2}
>  \tikzset{current plane/.prefix style={scale=#1}}
>  \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
>  % angle of "visibility"
>  \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
>  \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
>  \draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
> }
>
> %% document-wide tikz options and styles
>
> \tikzset{%
>  >=latex, % option for nice arrows
>  inner sep=0pt,%
>  outer sep=2pt,%
>  mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum
> size=3pt,fill=black,circle}%
> }
>
> \starttext
>
> \startTEXpage
> \starttikzpicture % "THE GLOBE" showcase
>
> \def\R{2.5} % sphere radius
> \def\angEl{35} % elevation angle
> \filldraw[ball color=white] (0,0) circle (\R);
> \foreach \t in {-80,-60,...,80} { \DrawLatitudeCircle{\R}{\t} }
> \foreach \t in {-5,-35,...,-175} { \DrawLongitudeCircle{\R}{\t} }
> % some fancy transparent shading
> % \tikzfading[name=fade inside,inner color=transparent!80,outer
> color=transparent!30]
> % \shadedraw[ball color=white,path fading=fade inside] (0,0) circle (\R);
>
> \stoptikzpicture
> \stopTEXpage
>
> \startTEXpage
> \starttikzpicture % CENT
>
> %% some definitions
>
> \def\R{2.5} % sphere radius
> \def\angEl{35} % elevation angle
> \def\angAz{-105} % azimuth angle
> \def\angPhi{-40} % longitude of point P
> \def\angBeta{19} % latitude of point P
>
> %% working planes
>
> \pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
> \tikzset{xyplane/.estyle={cm={cos(\angAz),sin(\angAz)*sin(\angEl),-
> sin(\angAz),cos(\angAz)*sin(\angEl),(0,-\H)}}}
> \LongitudePlane{xzplane}{\angEl}{\angAz}
> \LongitudePlane{pzplane}{\angEl}{\angPhi}
> \LatitudePlane{equator}{\angEl}{0}
>
> %% draw xyplane and sphere
>
> \draw[xyplane] (-2*\R,-2*\R) rectangle (2.2*\R,2.8*\R);
> \fill[ball color=white] (0,0) circle (\R); % 3D lighting effect
> %\fill[white] (0,0) circle (\R); % just a white circle
> \draw (0,0) circle (\R);
>
> %% characteristic points
>
> \coordinate (O) at (0,0);
> \coordinate[mark coordinate] (N) at (0,\H);
> \coordinate[mark coordinate] (S) at (0,-\H);
> \path[pzplane] (\angBeta:\R) coordinate[mark coordinate] (P);
> \path[pzplane] (\R,0) coordinate (PE);
> \path[xzplane] (\R,0) coordinate (XE);
> \path (PE) ++(0,-\H) coordinate (Paux); % to aid Phat calculation
> \coordinate[mark coordinate] (Phat) at (intersection cs: first line={(N)--(P)},
> second line={(S)--(Paux)});
>
> %% draw meridians and latitude circles
>
> \DrawLatitudeCircle{\R}{0} % equator
> %\DrawLatitudeCircle{\R}{\angBeta}
> \DrawLongitudeCircle{\R}{\angAz} % xzplane
> \DrawLongitudeCircle{\R}{\angAz+90} % yzplane
> \DrawLongitudeCircle{\R}{\angPhi} % pzplane
>
> %% draw xyz coordinate system
>
> \draw[xyplane,<->] (1.8*\R,0) node[below] {$x,\xi$} -- (0,0) -- (0,2.4*\R)
> node[right] {$y,\eta$};
> \draw[->] (0,-\H) -- (0,1.6*\R) node[above] {$z,\zeta$};
>
> %% draw lines and put labels
>
> \draw[dashed] (P) -- (N) +(0.3ex,0.6ex) node[above left] {\bf $N$};
> \draw (P) -- (Phat) node[above right] {\bf $\hat{P}$};
> \path (S) +(0.4ex,-0.4ex) node[below] {\bf $S$};
> \draw[->] (O) -- (P) node[above right] {\bf $P$};
> \draw[dashed] (XE) -- (O) -- (PE);
> \draw[pzplane,->,thin] (0:0.5*\R) to[bend right=15] node[pos=0.4,right]
> {$\beta$} (\angBeta:0.5*\R);
> \draw[equator,->,thin] (\angAz:0.4*\R) to[bend right=30] node[pos=0.4,below]
> {$\phi$} (\angPhi:0.4*\R);
> \draw[thin,decorate,decoration={brace,raise=0.5pt,amplitude=1ex}] (N) -- (O)
> node[midway,right=1ex] {$a$};
>
> \stoptikzpicture
> \stopTEXpage
>
> \startTEXpage
> \starttikzpicture % MERC
>
> %% some definitions
>
> \def\R{3} % sphere radius
> \def\angEl{25} % elevation angle
> \def\angAz{-100} % azimuth angle
> \def\angPhiOne{-50} % longitude of point P
> \def\angPhiTwo{-35} % longitude of point Q
> \def\angBeta{33} % latitude of point P and Q
>
> %% working planes
>
> \pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
> \LongitudePlane{xzplane}{\angEl}{\angAz}
> \LongitudePlane{pzplane}{\angEl}{\angPhiOne}
> \LongitudePlane{qzplane}{\angEl}{\angPhiTwo}
> \LatitudePlane{equator}{\angEl}{0}
>
> %% draw background sphere
>
> \fill[ball color=white] (0,0) circle (\R); % 3D lighting effect
> %\fill[white] (0,0) circle (\R); % just a white circle
> \draw (0,0) circle (\R);
>
> %% characteristic points
>
> \coordinate (O) at (0,0);
> \coordinate[mark coordinate] (N) at (0,\H);
> \coordinate[mark coordinate] (S) at (0,-\H);
> \path[xzplane] (\R,0) coordinate (XE);
> \path[pzplane] (\angBeta:\R) coordinate (P);
> \path[pzplane] (\R,0) coordinate (PE);
> \path[qzplane] (\angBeta:\R) coordinate (Q);
> \path[qzplane] (\R,0) coordinate (QE);
>
> %% meridians and latitude circles
>
> % \DrawLongitudeCircle{\R}{\angAz} % xzplane
> % \DrawLongitudeCircle{\R}{\angAz+90} % yzplane
> \DrawLongitudeCircle{\R}{\angPhiOne} % pzplane
> \DrawLongitudeCircle{\R}{\angPhiTwo} % qzplane
> \DrawLatitudeCircle{\R}{\angBeta}
> \DrawLatitudeCircle{\R}{0} % equator
> % shifted equator in node with nested call to tikz (I didn't know it's
> possible)
> \node at (0,1.6*\R) { \tikz{\DrawLatitudeCircle{\R}{0}} };
>
> %% draw lines and put labels
>
> \draw (-\R,-\H) -- (-\R,2*\R) (\R,-\H) -- (\R,2*\R);
> \draw[->] (XE) -- +(0,2*\R) node[above] {$y$};
> \node[above=8pt] at (N) {\bf $N$};
> \node[below=8pt] at (S) {\bf $S$};
> \draw[->] (O) -- (P);
> \draw[dashed] (XE) -- (O) -- (PE);
> \draw[dashed] (O) -- (QE);
> \draw[pzplane,->,thin] (0:0.5*\R) to[bend right=15] node[midway,right]
> {$\beta$} (\angBeta:0.5*\R);
> \path[pzplane] (0.5*\angBeta:\R) node[right] {$\hat{1}$};
> \path[qzplane] (0.5*\angBeta:\R) node[right] {$\hat{2}$};
> \draw[equator,->,thin] (\angAz:0.5*\R) to[bend right=30] node[pos=0.4,above]
> {$\phi_1$} (\angPhiOne:0.5*\R);
> \draw[equator,->,thin] (\angAz:0.6*\R) to[bend right=35] node[midway,below]
> {$\phi_2$} (\angPhiTwo:0.6*\R);
> \draw[equator,->] (-90:\R) arc (-90:-70:\R) node[below=0.3ex] {$x = a\phi$};
> \path[xzplane] (0:\R) node[below] {$\beta=0$};
> \path[xzplane] (\angBeta:\R) node[below left] {$\beta=\beta_0$};
>
> \stoptikzpicture
> \stopTEXpage
>
> \startTEXpage
> \starttikzpicture % KART
>
> \def\R{2.5}
>
> \node[draw,minimum size=2cm*\R,inner sep=0,outer sep=0,circle] (C) at (0,0)
> {};
> \coordinate (O) at (0,0);
> \coordinate[mark coordinate] (Phat) at (20:2.5*\R);
> \coordinate (T1) at (tangent cs: node=C, point={(Phat)}, solution=1);
> \coordinate (T2) at (tangent cs: node=C, point={(Phat)}, solution=2);
> \coordinate[mark coordinate] (P) at ($(T1)!0.5!(T2)$);
>
> \draw[dashed] (T1) -- (O) -- (T2) -- (Phat) -- (T1) -- (T2);
> \draw[->] (-1.5*\R,0) -- (2.5*\R,0) node[right] {$x$};
> \draw[->] (0,-1.5*\R) -- (0,1.5*\R) node[above] {$y$};
> \draw (O) node[below left] {\bf $O$} -- (P) +(1ex,0) node[above=1ex] {\bf
> $P$};
> \draw (P) -- (Phat) node[above=1ex] {\bf $\hat{P}$};
>
> \stoptikzpicture
> \stopTEXpage
>
> \stoptext
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Has anybody used asymptote without LaTeX?
  2008-09-22 18:03 Problem with text floating around tikz picture Marcin Borkowski
@ 2008-09-28 14:19 ` Alan BRASLAU
  2008-09-29  5:17   ` Zhichu Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Alan BRASLAU @ 2008-09-28 14:19 UTC (permalink / raw)
  To: ntg-context; +Cc: t.m.trzeciak

On 2008-09-28 04:35 Zhichu Chen wrote:
> It is said that Asymptote has supported PRC format 3D file: 
> http://asymptote.sourceforge.net/gallery/3D%20graphs/ 
> 
> I really wanna give it a try, but once I was building from the svn 
> source, I was told that I don't have LaTeX in my $PATH. I haven't 
> really been using LaTeX for a long time, and I prefer I don't need 
> to install a bunch of LaTeX programs and packages just for a 
> drawing program which, IMHO, only use LaTeX to make nice 
> labels. 
> 
> Is there any workarounds? And how to embed .prc files into 
> the .pdf document? 
>  -- 
> Best Regards
> Chen

This doesn't really answer your question
but may be of some related interest to the mailing list.

I am quite fond of pfg/tikz as a drawing package
that works rather well with plain tex, latex and context.
Asymptote is a similar tool, but it seems to be less portable.
However, it appears on the other hand to be much more powerful for 3D.
Neverless, I am sharing with this context list an impressive tikz example





-- 
Alan Braslau
CEA DSM-IRAMIS-SPEC
CNRS URA 2464
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.braslau@cea.fr

http://www-dna2006.cea.fr/

 .''`.
: :'  :
`. `'`
  `-
that I have adapted to context. (I have put the author on copy.)

Basically, the only changes to the latex source are
\usepackage{preview} -> \startTEXpage \stopTEXpage
\begin{tikzpicture} -> \starttikzpicture
and a few other minor syntax adaptations...)

Alan

% What is it
% ==========
%
% Examples inspired by the thread at comp.text.tex about how to convert some 
hand 
% drawn pictures into programmatic 3D sketches:
% 
http://groups.google.com/group/comp.text.tex/browse_thread/thread/a03baf5d6fa64865/f7e7b903f1d87a6a
% The sketches present stereographic and cylindrical map projections and they 
% pose some interesting challenges for doing them with a 2D drawing package 
PGF/TikZ. 
%
% The main idea is to draw in selected 3D planes and then project onto the 
canvas 
% coordinate system with an appriopriate transformation. Some highlights:
% [*] usage of pgf math engine for calculation of projection transformations 
and 
%     transitions points from visible (solid lines) to invisible (dashed 
lines) on 
%     meridians and latitude circles
% [*] definition of 3D plane transformation with expanded styles so that they 
are robust 
%     against redefinition of macros used in their construction
% [*] usage of named coordinates (nodes) for definition of characteristic 
points in 
%     local coordinate systems so that they are accessible outside of their 
plane of 
%     definition
% [*] calculation of intersections points with TikZ intersection coordinate 
system
% [*] usage of 'to' path operation instead of 'arc' for marking angles to 
allow for 
%     easy positioning of text labels on the curve
% [*] 3D lighting effects with shading
%
%
% Who's done it
% =============
%
% Tomasz M. Trzeciak
%
%
% Distribution and use
% ====================
%
% Use as you see fit. Consider giving a proper attribution to the author.
%
%
% Change log
% ==========
%
% 2008/08/07  posted to latex-community.org
% 2008/08/08  fixed some typos, added note about 'to' path operation to the 
description,
%             fixed positioning issue of nodes and 'to' path operation as 
suggested 
%             by Kjell, removed some dead code from KART picture
% 2008/09/28  adapted as an example to ConTeXt

\usemodule[tikz] 
\usetikzlibrary[calc,fadings,decorations.pathreplacing]

%% helper macros

\def\pgfmathsinandcos#1#2#3{% 
  \pgfmathsetmacro#1{sin(#3)}% 
  \pgfmathsetmacro#2{cos(#3)}% 
} 
\def\LongitudePlane#1#2#3{%
  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
  \pgfmathsinandcos\sint\cost{#3} % azimuth
  \tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\def\LatitudePlane#1#2#3{%
  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
  \pgfmathsinandcos\sint\cost{#3} % latitude
  \pgfmathsetmacro\yshift{\cosEl*\sint}
  \tikzset{#1/.estyle={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} % 
}
\def\DrawLongitudeCircle#1#2{
  \LongitudePlane{current plane}{\angEl}{#2}
  \tikzset{current plane/.prefix style={scale=#1}}
   % angle of "visibility" 
  \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
  \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1); 
  \draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1); 
}
\def\DrawLatitudeCircle#1#2{
  \LatitudePlane{current plane}{\angEl}{#2}
  \tikzset{current plane/.prefix style={scale=#1}}
  \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} 
  % angle of "visibility"
  \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}  
  \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1); 
  \draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}

%% document-wide tikz options and styles

\tikzset{%
  >=latex, % option for nice arrows 
  inner sep=0pt,%
  outer sep=2pt,%
  mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum 
size=3pt,fill=black,circle}%
}

\starttext

\startTEXpage
\starttikzpicture % "THE GLOBE" showcase

\def\R{2.5} % sphere radius
\def\angEl{35} % elevation angle 
\filldraw[ball color=white] (0,0) circle (\R);
\foreach \t in {-80,-60,...,80} { \DrawLatitudeCircle{\R}{\t} }
\foreach \t in {-5,-35,...,-175} { \DrawLongitudeCircle{\R}{\t} }
% some fancy transparent shading
% \tikzfading[name=fade inside,inner color=transparent!80,outer 
color=transparent!30]
% \shadedraw[ball color=white,path fading=fade inside] (0,0) circle (\R);

\stoptikzpicture 
\stopTEXpage

\startTEXpage
\starttikzpicture % CENT

%% some definitions 

\def\R{2.5} % sphere radius
\def\angEl{35} % elevation angle 
\def\angAz{-105} % azimuth angle 
\def\angPhi{-40} % longitude of point P 
\def\angBeta{19} % latitude of point P 

%% working planes

\pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
\tikzset{xyplane/.estyle={cm={cos(\angAz),sin(\angAz)*sin(\angEl),-
sin(\angAz),cos(\angAz)*sin(\angEl),(0,-\H)}}}
\LongitudePlane{xzplane}{\angEl}{\angAz}
\LongitudePlane{pzplane}{\angEl}{\angPhi}
\LatitudePlane{equator}{\angEl}{0}

%% draw xyplane and sphere

\draw[xyplane] (-2*\R,-2*\R) rectangle (2.2*\R,2.8*\R);
\fill[ball color=white] (0,0) circle (\R); % 3D lighting effect
%\fill[white] (0,0) circle (\R); % just a white circle
\draw (0,0) circle (\R);

%% characteristic points

\coordinate (O) at (0,0);
\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (S) at (0,-\H);
\path[pzplane] (\angBeta:\R) coordinate[mark coordinate] (P);
\path[pzplane] (\R,0) coordinate (PE);
\path[xzplane] (\R,0) coordinate (XE);
\path (PE) ++(0,-\H) coordinate (Paux); % to aid Phat calculation
\coordinate[mark coordinate] (Phat) at (intersection cs: first line={(N)--(P)}, 
second line={(S)--(Paux)});

%% draw meridians and latitude circles

\DrawLatitudeCircle{\R}{0} % equator
%\DrawLatitudeCircle{\R}{\angBeta}
\DrawLongitudeCircle{\R}{\angAz} % xzplane
\DrawLongitudeCircle{\R}{\angAz+90} % yzplane
\DrawLongitudeCircle{\R}{\angPhi} % pzplane

%% draw xyz coordinate system

\draw[xyplane,<->] (1.8*\R,0) node[below] {$x,\xi$} -- (0,0) -- (0,2.4*\R) 
node[right] {$y,\eta$};
\draw[->] (0,-\H) -- (0,1.6*\R) node[above] {$z,\zeta$};

%% draw lines and put labels

\draw[dashed] (P) -- (N) +(0.3ex,0.6ex) node[above left] {\bf $N$};
\draw (P) -- (Phat) node[above right] {\bf $\hat{P}$};
\path (S) +(0.4ex,-0.4ex) node[below] {\bf $S$};
\draw[->] (O) -- (P) node[above right] {\bf $P$};
\draw[dashed] (XE) -- (O) -- (PE);
\draw[pzplane,->,thin] (0:0.5*\R) to[bend right=15] node[pos=0.4,right] 
{$\beta$} (\angBeta:0.5*\R);
\draw[equator,->,thin] (\angAz:0.4*\R) to[bend right=30] node[pos=0.4,below] 
{$\phi$} (\angPhi:0.4*\R);
\draw[thin,decorate,decoration={brace,raise=0.5pt,amplitude=1ex}] (N) -- (O) 
node[midway,right=1ex] {$a$};

\stoptikzpicture 
\stopTEXpage

\startTEXpage
\starttikzpicture % MERC

%% some definitions 

\def\R{3} % sphere radius
\def\angEl{25} % elevation angle 
\def\angAz{-100} % azimuth angle 
\def\angPhiOne{-50} % longitude of point P 
\def\angPhiTwo{-35} % longitude of point Q 
\def\angBeta{33} % latitude of point P and Q

%% working planes

\pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
\LongitudePlane{xzplane}{\angEl}{\angAz}
\LongitudePlane{pzplane}{\angEl}{\angPhiOne}
\LongitudePlane{qzplane}{\angEl}{\angPhiTwo}
\LatitudePlane{equator}{\angEl}{0}

%% draw background sphere

\fill[ball color=white] (0,0) circle (\R); % 3D lighting effect
%\fill[white] (0,0) circle (\R); % just a white circle
\draw (0,0) circle (\R);

%% characteristic points

\coordinate (O) at (0,0);
\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (S) at (0,-\H);
\path[xzplane] (\R,0) coordinate (XE);
\path[pzplane] (\angBeta:\R) coordinate (P);
\path[pzplane] (\R,0) coordinate (PE);
\path[qzplane] (\angBeta:\R) coordinate (Q);
\path[qzplane] (\R,0) coordinate (QE);

%% meridians and latitude circles

% \DrawLongitudeCircle{\R}{\angAz} % xzplane
% \DrawLongitudeCircle{\R}{\angAz+90} % yzplane
\DrawLongitudeCircle{\R}{\angPhiOne} % pzplane
\DrawLongitudeCircle{\R}{\angPhiTwo} % qzplane
\DrawLatitudeCircle{\R}{\angBeta}
\DrawLatitudeCircle{\R}{0} % equator
% shifted equator in node with nested call to tikz (I didn't know it's 
possible)
\node at (0,1.6*\R) { \tikz{\DrawLatitudeCircle{\R}{0}} }; 

%% draw lines and put labels

\draw (-\R,-\H) -- (-\R,2*\R) (\R,-\H) -- (\R,2*\R);
\draw[->] (XE) -- +(0,2*\R) node[above] {$y$};
\node[above=8pt] at (N) {\bf $N$};
\node[below=8pt] at (S) {\bf $S$};
\draw[->] (O) -- (P);
\draw[dashed] (XE) -- (O) -- (PE);
\draw[dashed] (O) -- (QE);
\draw[pzplane,->,thin] (0:0.5*\R) to[bend right=15] node[midway,right] 
{$\beta$} (\angBeta:0.5*\R);
\path[pzplane] (0.5*\angBeta:\R) node[right] {$\hat{1}$};
\path[qzplane] (0.5*\angBeta:\R) node[right] {$\hat{2}$};
\draw[equator,->,thin] (\angAz:0.5*\R) to[bend right=30] node[pos=0.4,above] 
{$\phi_1$} (\angPhiOne:0.5*\R);
\draw[equator,->,thin] (\angAz:0.6*\R) to[bend right=35] node[midway,below] 
{$\phi_2$} (\angPhiTwo:0.6*\R);
\draw[equator,->] (-90:\R) arc (-90:-70:\R) node[below=0.3ex] {$x = a\phi$};
\path[xzplane] (0:\R) node[below] {$\beta=0$};
\path[xzplane] (\angBeta:\R) node[below left] {$\beta=\beta_0$};

\stoptikzpicture 
\stopTEXpage

\startTEXpage
\starttikzpicture % KART

\def\R{2.5}

\node[draw,minimum size=2cm*\R,inner sep=0,outer sep=0,circle] (C) at (0,0) 
{};
\coordinate (O) at (0,0);
\coordinate[mark coordinate] (Phat) at (20:2.5*\R);
\coordinate (T1) at (tangent cs: node=C, point={(Phat)}, solution=1);
\coordinate (T2) at (tangent cs: node=C, point={(Phat)}, solution=2);
\coordinate[mark coordinate] (P) at ($(T1)!0.5!(T2)$);

\draw[dashed] (T1) -- (O) -- (T2) -- (Phat) -- (T1) -- (T2);
\draw[->] (-1.5*\R,0) -- (2.5*\R,0) node[right] {$x$};
\draw[->] (0,-1.5*\R) -- (0,1.5*\R) node[above] {$y$};
\draw (O) node[below left] {\bf $O$} -- (P) +(1ex,0) node[above=1ex] {\bf 
$P$};
\draw (P) -- (Phat) node[above=1ex] {\bf $\hat{P}$};

\stoptikzpicture 
\stopTEXpage

\stoptext

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-10-11 12:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-28  2:35 Has anybody used asymptote without LaTeX? Zhichu Chen
  -- strict thread matches above, loose matches on Subject: below --
2008-09-22 18:03 Problem with text floating around tikz picture Marcin Borkowski
2008-09-28 14:19 ` Has anybody used asymptote without LaTeX? Alan BRASLAU
2008-09-29  5:17   ` Zhichu Chen
2008-09-29  5:57     ` Yue Wang
2008-09-29 12:09       ` Zhichu Chen
2008-09-29 17:19       ` Michail Vidiassov
2008-10-08 16:49         ` Zhichu Chen
2008-10-10  2:48           ` Zhichu Chen
2008-10-11  5:25             ` Michail Vidiassov
2008-10-11 12:02               ` Zhichu Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).